Allow there to be no blog posts for homepage
This commit is contained in:
parent
f8d5cc5ba5
commit
0c3b6633bd
1 changed files with 2 additions and 1 deletions
|
@ -25,6 +25,7 @@ class HomePage(BasePage):
|
|||
context["latest_blog_post"] = (
|
||||
BlogPostPage.objects.live() # type:ignore[attr-defined]
|
||||
.defer_streamfields()
|
||||
.latest("date")
|
||||
.order_by("-date")
|
||||
.first()
|
||||
)
|
||||
return context
|
||||
|
|
Loading…
Reference in a new issue