Skip to content

Commit

Permalink
Merge pull request #67 from acdh-oeaw/linkify-links
Browse files Browse the repository at this point in the history
refactor common cols to TibscholEntityMixinTable
  • Loading branch information
gythaogg authored Jun 11, 2024
2 parents e50d4f7 + de664bc commit 21e3edd
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions apis_ontology/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,14 @@ class Meta:
]
exclude = ["desc", "view", "edit", "noduplicate", "delete"]

def render_external_links(self, value):
return render_links(value)

def render_latitude(self, value):
return render_coordinate(value)

def render_longitude(self, value):
return render_coordinate(value)


class PersonTable(AbstractEntityTable):
class PersonTable(TibscholEntityMixinTable):
class Meta:
model = Person
fields = [
Expand All @@ -71,19 +68,8 @@ class Meta:
]
exclude = ["desc", "view", "edit", "noduplicate", "delete"]

id = tables.Column(
linkify=lambda record: record.get_absolute_url(),
empty_values=[],
)

def render_external_links(self, value):
return render_links(value)

def render_alternative_names(self, value):
return render_list_field(value)


class WorkTable(AbstractEntityTable):
class WorkTable(TibscholEntityMixinTable):
class Meta:
model = Work
fields = ["id", "name", "author"]
Expand All @@ -94,28 +80,17 @@ class Meta:
else None
}

id = tables.Column(
linkify=lambda record: record.get_absolute_url(),
empty_values=[],
)
author = tables.Column(verbose_name="Author", accessor="author", orderable=False)


class InstanceTable(AbstractEntityTable):
class InstanceTable(TibscholEntityMixinTable):
class Meta:
model = Instance
fields = ["id", "name", "start_date_written", "author"]
exclude = ["desc", "view", "edit", "noduplicate", "delete"]

id = tables.Column(
linkify=lambda record: record.get_absolute_url(),
empty_values=[],
)
author = tables.Column(verbose_name="Author", accessor="author", orderable=False)

def render_external_links(self, value):
return render_links(value)

def render_availability(self, value):
symbol = "indeterminate_question_box"
if value == "lost":
Expand Down

0 comments on commit 21e3edd

Please sign in to comment.