diff --git a/district/models.py b/district/models.py index 242302e3badeb6ab5eb9c936b170cf2b15ca724e..a9d3d7ce63e9f541031b91e2d32c74f1e8b21510 100644 --- a/district/models.py +++ b/district/models.py @@ -551,7 +551,7 @@ class DistrictArticlesPage( DistrictArticlePage.objects.child_of(self) ), self.max_items, - request.GET.get("page"), + request.GET.get("page", 1), ) return context @@ -620,7 +620,7 @@ class DistrictArticlesPage( return { "article_page_list": self.get_page_with_shared_articles( - article_page_qs, self.max_items, request.GET.get("page") + article_page_qs, self.max_items, request.GET.get("page", 1) ), "tag": tag, } diff --git a/main/models.py b/main/models.py index 1e52a32a75272dc639a89bb3217e220ec84725a7..c7843c95788848cce19c4b8f000da77c6caf2487 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")[ :11 ] # dám LIMIT +1, abych věděl, jestli má cenu show_next ctx["article_article_list"] = self.materialize_shared_articles_query( diff --git a/shared/models.py b/shared/models.py index 391732d48368ab03aa7f80732adee2d1d7199f58..2e83855a6c5df4786bac5950b017b2ed36a06ab1 100644 --- a/shared/models.py +++ b/shared/models.py @@ -420,13 +420,23 @@ class ArticlesMixin(models.Model): shared_tags__slug__in=self.shared_tags.values_list("slug", flat=True), ) if isinstance(original_query, models.QuerySet) - else query.filter( - ~Q( - page_ptr_id__in=list( - map(lambda article: article.pk, original_query) - ) - ), - shared_tags__slug__in=self.shared_tags.values_list("slug", flat=True), + else ( + query.filter( + ~Q( + page_ptr_id__in=list( + map(lambda article: article.pk, original_query) + ) + ), + shared_tags__slug__in=self.shared_tags.values_list( + "slug", flat=True + ), + ) + if original_query is not None + else query.filter( + shared_tags__slug__in=self.shared_tags.values_list( + "slug", flat=True + ), + ) ) ) return filtered_query.live().specific() diff --git a/uniweb/models.py b/uniweb/models.py index 07fdf9d5436c88336f741c632e67bee853a69722..de3b627f40126a8e0eaada449c5fa9813cdff461 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -545,7 +545,7 @@ class UniwebArticlesIndexPage( def get_context(self, request): context = super().get_context(request) - num = request.GET.get("page") + num = request.GET.get("page", 1) tag = request.GET.get("tag") tag_params = self.filter_by_tag_name(tag)