Browse Source

Add ExportedCategory model

pull/1799/head
Hironsan 2 years ago
parent
commit
ae19d375f6
1 changed files with 18 additions and 0 deletions
  1. 18
      backend/data_export/models.py

18
backend/data_export/models.py

@ -0,0 +1,18 @@
import abc
from typing import Any, Dict, Protocol
from labels.models import Category
class ExportedLabel(Protocol):
@abc.abstractmethod
def dict(self) -> Dict[str, Any]:
raise NotImplementedError("Please implement this method in the subclass.")
class ExportedCategory(Category):
def dict(self) -> Dict[str, Any]:
return {"category": self.label.text}
class Meta:
proxy = True
Loading…
Cancel
Save