From 3bce17c91533d897fa289cbe7c21ca75c5917d4e Mon Sep 17 00:00:00 2001
From: "jindra12.underdark" <jindra12.underdark@gmail.com>
Date: Tue, 15 Aug 2023 18:12:49 +0200
Subject: [PATCH] Reverse date sort order

#210
---
 main/models.py   | 4 ++--
 shared/models.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/main/models.py b/main/models.py
index c7843c95..8349b291 100644
--- a/main/models.py
+++ b/main/models.py
@@ -423,7 +423,7 @@ class MainArticlesPage(
 
             article_list = self.append_all_shared_articles_query(
                 MainArticlePage.objects.filter(article_type=ARTICLE_TYPES.PRESS_RELEASE)
-            ).order_by("union_date", "union_title")[
+            ).order_by("-union_date", "union_title")[
                 :11
             ]  # dám LIMIT +1, abych věděl, jestli má cenu show_next
             ctx["article_article_list"] = self.materialize_shared_articles_query(
@@ -454,7 +454,7 @@ class MainArticlesPage(
                 MainArticlePage.objects.filter(
                     article_type=ARTICLE_TYPES.PRESS_RELEASE
                 ),
-            ).order_by("union_date", "union_title"),
+            ).order_by("-union_date", "union_title"),
             10,
             request.GET.get("page", 1),
         )
diff --git a/shared/models.py b/shared/models.py
index 2e83855a..119fbf4a 100644
--- a/shared/models.py
+++ b/shared/models.py
@@ -630,13 +630,13 @@ class ArticlesMixin(models.Model):
                 prepared_query.union(main_by_values)
                 .union(uniweb_by_values)
                 .union(district_by_values)
-                .order_by("union_date")
+                .order_by("-union_date")
             )
         else:
             return (
                 main_by_values.union(uniweb_by_values)
                 .union(district_by_values)
-                .order_by("union_date")
+                .order_by("-union_date")
             )
 
     def materialize_shared_articles_query(self, results):
-- 
GitLab