From b4c5032448d1455cb415b5096eae8bc94d60de56 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 26 Jun 2022 12:55:08 +0100 Subject: [PATCH] Prefetch tags when listing --- website/blog/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/blog/models.py b/website/blog/models.py index 1be8a3c..c6dd8e0 100644 --- a/website/blog/models.py +++ b/website/blog/models.py @@ -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