Merge pull request #1176 from umap-project/search-pagination-setting

Add a setting for the number of maps per search
This commit is contained in:
David Larlet 2023-06-28 16:07:37 -04:00 committed by GitHub
commit 69b2af9aa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View file

@ -234,6 +234,7 @@ SITE_NAME = 'uMap'
UMAP_DEMO_SITE = env('UMAP_DEMO_SITE', default=False) UMAP_DEMO_SITE = env('UMAP_DEMO_SITE', default=False)
UMAP_EXCLUDE_DEFAULT_MAPS = False UMAP_EXCLUDE_DEFAULT_MAPS = False
UMAP_MAPS_PER_PAGE = 5 UMAP_MAPS_PER_PAGE = 5
UMAP_MAPS_PER_SEARCH = 25
UMAP_MAPS_PER_PAGE_OWNER = 10 UMAP_MAPS_PER_PAGE_OWNER = 10
UMAP_SEARCH_CONFIGURATION = "simple" UMAP_SEARCH_CONFIGURATION = "simple"
UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa

View file

@ -78,6 +78,8 @@ UMAP_EXCLUDE_DEFAULT_MAPS = False
# How many maps should be showcased on the main page resp. on the user page # How many maps should be showcased on the main page resp. on the user page
UMAP_MAPS_PER_PAGE = 5 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 # How many maps should be showcased on the user page, if owner
UMAP_MAPS_PER_PAGE_OWNER = 10 UMAP_MAPS_PER_PAGE_OWNER = 10

View file

@ -235,6 +235,10 @@ class Search(TemplateView, PaginatorMixin):
else: else:
return super(Search, self).get_template_names() return super(Search, self).get_template_names()
@property
def per_page(self):
return settings.UMAP_MAPS_PER_SEARCH
search = Search.as_view() search = Search.as_view()