Skip to content
Snippets Groups Projects
Commit d1b3113c authored by Ondrej Rehounek's avatar Ondrej Rehounek
Browse files

district and region: Set ordering as '-last_published_at'

parent 8cbe1908
No related branches found
No related tags found
2 merge requests!435Release upgrades,!430Feature/majak misc enhancements
Pipeline #7043 passed
......@@ -193,7 +193,13 @@ class DistrictHomePage(MetadataPageMixin, CalendarMixin, Page):
@property
def articles(self):
return self.get_descendants().type(DistrictArticlePage).live().specific()[:6]
return (
self.get_descendants()
.type(DistrictArticlePage)
.live()
.specific()
.order_by("-last_published_at")[:6]
)
@property
def articles_page(self):
......@@ -271,7 +277,7 @@ class DistrictArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page):
self.get_siblings(inclusive=False)
.live() # TODO? filtrovat na stejné tagy?
.specific()
.order_by("-uniwebarticlepage__date")[:3]
.order_by("-last_published_at")[:3]
)
return context
......@@ -302,7 +308,7 @@ class DistrictArticlesPage(SubpageMixin, MetadataPageMixin, Page):
def get_context(self, request):
context = super().get_context(request)
context["articles"] = Paginator(
self.get_children().live().specific(),
self.get_children().live().specific().order_by("-last_published_at"),
self.max_items,
).get_page(request.GET.get("page"))
return context
......@@ -388,7 +394,7 @@ class DistrictTagsPage(SubpageMixin, MetadataPageMixin, Page):
return {
"article_page_list": Paginator(
article_page_qs,
article_page_qs.order_by("-last_published_at"),
self.root_page.articles_page.max_items,
).get_page(request.GET.get("page")),
"tag": tag,
......
......@@ -193,7 +193,13 @@ class RegionHomePage(MetadataPageMixin, CalendarMixin, Page):
@property
def articles(self):
return self.get_descendants().type(RegionArticlePage).live().specific()[:6]
return (
self.get_descendants()
.type(RegionArticlePage)
.live()
.specific()
.order_by("-last_published_at")[:6]
)
@property
def articles_page(self):
......@@ -269,7 +275,7 @@ class RegionArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page):
self.get_siblings(inclusive=False)
.live()
.specific()
.order_by("-uniwebarticlepage__date")[:3]
.order_by("-last_published_at")[:3]
)
return context
......@@ -300,7 +306,7 @@ class RegionArticlesPage(SubpageMixin, MetadataPageMixin, Page):
def get_context(self, request):
context = super().get_context(request)
context["articles"] = Paginator(
self.get_children().live().specific(),
self.get_children().live().specific().order_by("-last_published_at"),
self.max_items,
).get_page(request.GET.get("page"))
return context
......@@ -386,7 +392,7 @@ class RegionTagsPage(SubpageMixin, MetadataPageMixin, Page):
return {
"article_page_list": Paginator(
article_page_qs,
article_page_qs.order_by("-last_published_at"),
self.root_page.articles_page.max_items,
).get_page(request.GET.get("page")),
"tag": tag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment