From 2ec6a31b5fc76f73a388452cd1e96aa49bb665f4 Mon Sep 17 00:00:00 2001 From: Harpo Date: Tue, 2 Jul 2024 13:20:10 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AC=20Adds=20author=20bio=20serializer?= =?UTF-8?q?=20(#187)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Author bio Includes `bio` in API fields. Closes #185 --- authors/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/authors/models.py b/authors/models.py index 6fd8210..1a8334e 100644 --- a/authors/models.py +++ b/authors/models.py @@ -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'), ]