From de664bc20f07a021f57a7c5ee62f29cae7a88e46 Mon Sep 17 00:00:00 2001 From: Gytha Ogg Date: Tue, 11 Jun 2024 07:54:30 +0200 Subject: [PATCH] refactor common cols to TibscholEntityMixinTable --- apis_ontology/tables.py | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/apis_ontology/tables.py b/apis_ontology/tables.py index 095c015..ac464d0 100644 --- a/apis_ontology/tables.py +++ b/apis_ontology/tables.py @@ -52,9 +52,6 @@ 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) @@ -62,7 +59,7 @@ def render_longitude(self, value): return render_coordinate(value) -class PersonTable(AbstractEntityTable): +class PersonTable(TibscholEntityMixinTable): class Meta: model = Person fields = [ @@ -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"] @@ -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":