Skip to content

Commit

Permalink
Merge pull request #79 from acdh-oeaw/author-dates-person-active-at-p…
Browse files Browse the repository at this point in the history
…lace

Add dates to author active at place
  • Loading branch information
gythaogg authored Jun 25, 2024
2 parents 76a4f95 + f8e9854 commit a6477a8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apis_ontology/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,28 @@ def render_work_author(self, value):
if work.author_id:
return f"{work.author_name} ({work.author_id})"
return ""


class PersonActiveAtPlaceTable(TibScholRelationMixinTable):
class Meta(TibScholRelationMixinTable.Meta):
fields = [
"subj",
"obj",
"author_dates",
"edit",
"delete",
]

subj = tables.Column(verbose_name="Person")
author_dates = tables.Column(
verbose_name="Lifespan", orderable=False, accessor="subj"
)
obj = tables.Column(verbose_name="Place")

def render_author_dates(self, value):
author = Person.objects.get(pk=value.pk)
return (
(author.start_date_written if author.start_date_written else "")
+ " - "
+ (author.end_date_written if author.end_date_written else "")
)

0 comments on commit a6477a8

Please sign in to comment.