Inline select_related
calls
This commit is contained in:
parent
6403aca2a2
commit
735ab73ec0
2 changed files with 3 additions and 6 deletions
|
@ -40,8 +40,7 @@ class BlogPostListPage(BaseListingPage):
|
||||||
return (
|
return (
|
||||||
BlogPostPage.objects.descendant_of(self)
|
BlogPostPage.objects.descendant_of(self)
|
||||||
.live()
|
.live()
|
||||||
.select_related("hero_image")
|
.select_related("hero_image", "hero_unsplash_photo")
|
||||||
.select_related("hero_unsplash_photo")
|
|
||||||
.prefetch_related("tags")
|
.prefetch_related("tags")
|
||||||
.order_by("-date", "title")
|
.order_by("-date", "title")
|
||||||
)
|
)
|
||||||
|
@ -120,8 +119,7 @@ class BlogPostCollectionPage(BaseListingPage):
|
||||||
def get_listing_pages(self) -> models.QuerySet:
|
def get_listing_pages(self) -> models.QuerySet:
|
||||||
return (
|
return (
|
||||||
BlogPostPage.objects.child_of(self)
|
BlogPostPage.objects.child_of(self)
|
||||||
.select_related("hero_image")
|
.select_related("hero_image", "hero_unsplash_photo")
|
||||||
.select_related("hero_unsplash_photo")
|
|
||||||
.prefetch_related("tags")
|
.prefetch_related("tags")
|
||||||
.order_by("-date", "title")
|
.order_by("-date", "title")
|
||||||
)
|
)
|
||||||
|
|
|
@ -200,8 +200,7 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
|
||||||
self.get_children()
|
self.get_children()
|
||||||
.live()
|
.live()
|
||||||
.specific()
|
.specific()
|
||||||
.select_related("hero_image")
|
.select_related("hero_image", "hero_unsplash_photo")
|
||||||
.select_related("hero_unsplash_photo")
|
|
||||||
.order_by("title")
|
.order_by("title")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue