Correctly allow ordering of collection pages

`.specific` isn't quite as magical as it needs to be, so we have to be
explicit
This commit is contained in:
Jake Howard 2022-08-27 13:13:14 +01:00
parent 2df1e82f31
commit e79625a441
Signed by: jake
GPG Key ID: 57AFB45680EDD477

View File

@ -118,7 +118,13 @@ class BlogPostCollectionPage(BaseListingPage):
subpage_types = [BlogPostPage]
def get_listing_pages(self) -> models.QuerySet:
return super().get_listing_pages().order_by("-date")
return (
BlogPostPage.objects.child_of(self)
.select_related("hero_image")
.select_related("hero_unsplash_photo")
.prefetch_related("tags")
.order_by("-date", "title")
)
@property
def feed_class(self) -> Type[ContentPageFeed]: