Prefetch tags when listing

This commit is contained in:
Jake Howard 2022-06-26 12:55:08 +01:00
parent d3badf5339
commit b4c5032448
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -19,7 +19,11 @@ class BlogListPage(BaseContentMixin, BasePage): # type: ignore[misc]
def get_context(self, request: HttpRequest) -> dict:
context = super().get_context(request)
context["child_pages"] = (
self.get_children().live().specific().select_related("hero_image")
self.get_children()
.live()
.specific()
.select_related("hero_image")
.prefetch_related("tags")
)
return context