Skip to content

Commit

Permalink
fix(blog): fix thumbnail api func
Browse files Browse the repository at this point in the history
  • Loading branch information
hUwUtao committed Jun 1, 2024
1 parent b547c62 commit 85b3cbc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class BlogPage(Page):
Image,
on_delete=models.SET_NULL,
null=True,
blank=False,
blank=True,
related_name='+',
)

intro = models.CharField(max_length=250)
intro = models.CharField(max_length=250, blank=True)
body = RichTextField(blank=True)
localize_default_translation_mode = 'simple'

Expand All @@ -45,11 +45,9 @@ def thumbnail_set(self) -> dict[str, str]:
"""
Generate rendition set (might trouble api client though)
"""
global THUMB_RENDITIONS

return dict(
(k, self.thumb.get_rendition(v).full_url)
for k, v in THUMB_RENDITIONS.items()
for k, v in self.THUMB_RENDITIONS.items()
)

api_fields = [
Expand All @@ -59,4 +57,4 @@ def thumbnail_set(self) -> dict[str, str]:
# APIField(
# 'authors'
# ), # This will nest the relevant BlogPageAuthor objects in the API response
]
]

0 comments on commit 85b3cbc

Please sign in to comment.