From a87309cee64f3102a71f7aa1d266ed57e664f360 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Tue, 27 Jun 2023 18:41:00 -0400 Subject: [PATCH] Add a setting for the number of maps per search Useful for https://github.com/umap-project/umap-dsfr --- umap/settings/base.py | 1 + umap/settings/local.py.sample | 2 ++ umap/views.py | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/umap/settings/base.py b/umap/settings/base.py index e1c009c3..2d8e5b97 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -234,6 +234,7 @@ SITE_NAME = 'uMap' UMAP_DEMO_SITE = env('UMAP_DEMO_SITE', default=False) UMAP_EXCLUDE_DEFAULT_MAPS = False UMAP_MAPS_PER_PAGE = 5 +UMAP_MAPS_PER_SEARCH = 25 UMAP_MAPS_PER_PAGE_OWNER = 10 UMAP_SEARCH_CONFIGURATION = "simple" UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa diff --git a/umap/settings/local.py.sample b/umap/settings/local.py.sample index de8b8437..1a8a846f 100644 --- a/umap/settings/local.py.sample +++ b/umap/settings/local.py.sample @@ -78,6 +78,8 @@ UMAP_EXCLUDE_DEFAULT_MAPS = False # How many maps should be showcased on the main page resp. on the user page UMAP_MAPS_PER_PAGE = 5 +# How many maps should be looked for when performing a (sub)search +UMAP_MAPS_PER_SEARCH = 15 # How many maps should be showcased on the user page, if owner UMAP_MAPS_PER_PAGE_OWNER = 10 diff --git a/umap/views.py b/umap/views.py index cdd893a1..5ca3d821 100644 --- a/umap/views.py +++ b/umap/views.py @@ -235,6 +235,10 @@ class Search(TemplateView, PaginatorMixin): else: return super(Search, self).get_template_names() + @property + def per_page(self): + return settings.UMAP_MAPS_PER_SEARCH + search = Search.as_view()