diff --git a/fedireads/models/book.py b/fedireads/models/book.py index ca198584..a6877739 100644 --- a/fedireads/models/book.py +++ b/fedireads/models/book.py @@ -184,3 +184,14 @@ class Author(FedireadsModel): @property def activitypub_serialize(self): return activitypub.get_author(self) + + @property + def display_name(self): + ''' Helper to return a displayable name''' + if self.name: + return name + # don't want to return a spurious space if all of these are None + elif self.first_name and self.last_name: + return self.first_name + ' ' + self.last_name + else: + return self.last_name or self.first_name diff --git a/fedireads/templates/author.html b/fedireads/templates/author.html index f9da61d0..39148909 100644 --- a/fedireads/templates/author.html +++ b/fedireads/templates/author.html @@ -2,7 +2,7 @@ {% load fr_display %} {% block content %}
@@ -12,7 +12,7 @@