Use name field only for author name

It feels janky to remove a more granular name designation, but all these
first/last name fields were algorithmically populated by a dubious
process of splitting the name by a space character. If it makes sense to
have first/last name fields, it should be re-added with some
consideration.
This commit is contained in:
Mouse Reeve
2020-12-12 09:47:27 -08:00
parent 5cf9e24ae5
commit 31a407d74a
7 changed files with 35 additions and 20 deletions

View File

@ -21,8 +21,6 @@ class Author(ActivitypubMixin, BookWyrmModel):
born = fields.DateTimeField(blank=True, null=True)
died = fields.DateTimeField(blank=True, null=True)
name = fields.CharField(max_length=255)
last_name = models.CharField(max_length=255, blank=True, null=True)
first_name = models.CharField(max_length=255, blank=True, null=True)
aliases = fields.ArrayField(
models.CharField(max_length=255), blank=True, default=list
)
@ -42,14 +40,4 @@ class Author(ActivitypubMixin, BookWyrmModel):
''' editions and works both use "book" instead of model_name '''
return 'https://%s/author/%s' % (DOMAIN, self.id)
@property
def display_name(self):
''' Helper to return a displayable name'''
if self.name:
return self.name
# don't want to return a spurious space if all of these are None
if self.first_name and self.last_name:
return self.first_name + ' ' + self.last_name
return self.last_name or self.first_name
activity_serializer = activitypub.Author