Skip to content

Commit

Permalink
feat(tables): add individual entity tables
Browse files Browse the repository at this point in the history
Add basic table classes for all entity model classes.

Closes: #55
  • Loading branch information
koeaw committed Dec 9, 2024
1 parent 3170969 commit 23d6840
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions apis_ontology/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
from apis_core.apis_entities.tables import AbstractEntityTable
from django_tables2.utils import A

from .models import (
Event,
Expression,
Group,
Item,
Manifestation,
Person,
Place,
Poster,
Work,
)

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -43,3 +55,54 @@ class Meta(AbstractEntityTable.Meta):
class TitleFieldsMixin(tables.Table):
class Meta:
fields = ["title", "subtitle"]


class WorkTable(BaseEntityTable):
class Meta(TitleFieldsMixin.Meta, BaseEntityTable.Meta):
model = Work


class ExpressionTable(BaseEntityTable):
class Meta(TitleFieldsMixin.Meta, BaseEntityTable.Meta):
model = Expression


class ManifestationTable(BaseEntityTable):
class Meta(TitleFieldsMixin.Meta, BaseEntityTable.Meta):
model = Manifestation


class ItemTable(BaseEntityTable):
class Meta(TitleFieldsMixin.Meta, BaseEntityTable.Meta):
model = Item


class PersonTable(BaseEntityTable):
class Meta(BaseEntityTable.Meta):
model = Person
fields = ["forename", "surname"]
order_by = "surname"


class PlaceTable(BaseEntityTable):
class Meta(BaseEntityTable.Meta):
model = Place
fields = ["label"]


class GroupTable(BaseEntityTable):
class Meta(BaseEntityTable.Meta):
model = Group
fields = ["label"]


class EventTable(BaseEntityTable):
class Meta(BaseEntityTable.Meta):
model = Event
fields = ["label"]


class PosterTable(BaseEntityTable):
class Meta(BaseEntityTable.Meta):
model = Poster
fields = ["label"]

0 comments on commit 23d6840

Please sign in to comment.