Skip to content

Commit

Permalink
🧬 Adds author bio serializer (#187)
Browse files Browse the repository at this point in the history
# Author bio
Includes `bio` in API fields.

Closes #185
  • Loading branch information
mrharpo authored Jul 2, 2024
1 parent 6185334 commit 2ec6a31
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions authors/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ def name(self):
def image(self):
return self.author.image if self.author else None

@property
def bio(self):
return self.author.bio if self.author else None

api_fields: ClassVar[list[APIField]] = [
APIField('author_id'),
APIField('name'),
APIField('image', serializer=ImageRenditionField('fill-100x100')),
APIField('bio'),
]


Expand Down

0 comments on commit 2ec6a31

Please sign in to comment.