Skip to content
Snippets Groups Projects
Verified Commit 29ff8137 authored by jindra12's avatar jindra12
Browse files

Finish pagination fixes

parent b354d13e
No related branches found
No related tags found
2 merge requests!816Release,!801Prepare basic shared tags
Pipeline #13943 passed
......@@ -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,
}
......
......@@ -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(
......
......@@ -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(
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),
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()
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment