Skip to content
Snippets Groups Projects
Commit 18700808 authored by OndraRehounek's avatar OndraRehounek
Browse files

Fix ordering fields

parent 59f3e091
No related branches found
No related tags found
2 merge requests!435Release upgrades,!430Feature/majak misc enhancements
Pipeline #7147 passed
...@@ -193,7 +193,7 @@ class DistrictHomePage(MetadataPageMixin, CalendarMixin, Page): ...@@ -193,7 +193,7 @@ class DistrictHomePage(MetadataPageMixin, CalendarMixin, Page):
.type(DistrictArticlePage) .type(DistrictArticlePage)
.live() .live()
.specific() .specific()
.order_by("-last_published_at")[:6] .order_by("-districtarticlepage__date")[:6]
) )
@property @property
...@@ -276,7 +276,7 @@ class DistrictArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page): ...@@ -276,7 +276,7 @@ class DistrictArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page):
self.get_siblings(inclusive=False) self.get_siblings(inclusive=False)
.live() # TODO? filtrovat na stejné tagy? .live() # TODO? filtrovat na stejné tagy?
.specific() .specific()
.order_by("-last_published_at")[:3] .order_by("-districtarticlepage__date")[:3]
) )
return context return context
...@@ -307,7 +307,10 @@ class DistrictArticlesPage(SubpageMixin, MetadataPageMixin, Page): ...@@ -307,7 +307,10 @@ class DistrictArticlesPage(SubpageMixin, MetadataPageMixin, Page):
def get_context(self, request): def get_context(self, request):
context = super().get_context(request) context = super().get_context(request)
context["articles"] = Paginator( context["articles"] = Paginator(
self.get_children().live().specific().order_by("-last_published_at"), self.get_children()
.live()
.specific()
.order_by("-districtarticlepage__date"),
self.max_items, self.max_items,
).get_page(request.GET.get("page")) ).get_page(request.GET.get("page"))
return context return context
...@@ -393,7 +396,7 @@ class DistrictTagsPage(SubpageMixin, MetadataPageMixin, Page): ...@@ -393,7 +396,7 @@ class DistrictTagsPage(SubpageMixin, MetadataPageMixin, Page):
return { return {
"article_page_list": Paginator( "article_page_list": Paginator(
article_page_qs.order_by("-last_published_at"), article_page_qs.order_by("-date"),
self.root_page.articles_page.max_items, self.root_page.articles_page.max_items,
).get_page(request.GET.get("page")), ).get_page(request.GET.get("page")),
"tag": tag, "tag": tag,
......
...@@ -193,7 +193,7 @@ class RegionHomePage(MetadataPageMixin, CalendarMixin, Page): ...@@ -193,7 +193,7 @@ class RegionHomePage(MetadataPageMixin, CalendarMixin, Page):
.type(RegionArticlePage) .type(RegionArticlePage)
.live() .live()
.specific() .specific()
.order_by("-last_published_at")[:6] .order_by("-regionarticlepage__date")[:6]
) )
@property @property
...@@ -274,7 +274,7 @@ class RegionArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page): ...@@ -274,7 +274,7 @@ class RegionArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page):
self.get_siblings(inclusive=False) self.get_siblings(inclusive=False)
.live() .live()
.specific() .specific()
.order_by("-last_published_at")[:3] .order_by("-regionarticlepage__date")[:3]
) )
return context return context
...@@ -305,7 +305,7 @@ class RegionArticlesPage(SubpageMixin, MetadataPageMixin, Page): ...@@ -305,7 +305,7 @@ class RegionArticlesPage(SubpageMixin, MetadataPageMixin, Page):
def get_context(self, request): def get_context(self, request):
context = super().get_context(request) context = super().get_context(request)
context["articles"] = Paginator( context["articles"] = Paginator(
self.get_children().live().specific().order_by("-last_published_at"), self.get_children().live().specific().order_by("-regionarticlepage__date"),
self.max_items, self.max_items,
).get_page(request.GET.get("page")) ).get_page(request.GET.get("page"))
return context return context
...@@ -391,7 +391,7 @@ class RegionTagsPage(SubpageMixin, MetadataPageMixin, Page): ...@@ -391,7 +391,7 @@ class RegionTagsPage(SubpageMixin, MetadataPageMixin, Page):
return { return {
"article_page_list": Paginator( "article_page_list": Paginator(
article_page_qs.order_by("-last_published_at"), article_page_qs.order_by("-date"),
self.root_page.articles_page.max_items, self.root_page.articles_page.max_items,
).get_page(request.GET.get("page")), ).get_page(request.GET.get("page")),
"tag": tag, "tag": tag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment