From ef30a910676a901317042911a0520f31f1761036 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 29 Jul 2022 09:11:14 +0100 Subject: [PATCH] Move page size to model --- website/search/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/search/models.py b/website/search/models.py index 8cf2a0a..008464d 100644 --- a/website/search/models.py +++ b/website/search/models.py @@ -16,6 +16,7 @@ class SearchPage(BaseContentMixin, BasePage): # type: ignore[misc] parent_page_types = ["home.HomePage"] content_panels = BasePage.content_panels + BaseContentMixin.content_panels search_fields = BasePage.search_fields + BaseContentMixin.search_fields + PAGE_SIZE = 15 @cached_property def reading_time(self) -> int: @@ -37,7 +38,7 @@ class SearchPage(BaseContentMixin, BasePage): # type: ignore[misc] else: pages = Page.objects.none() - paginator = Paginator(pages, 15) + paginator = Paginator(pages, self.PAGE_SIZE) page_num = request.GET.get("page", "1") try: results = paginator.page(page_num)