Self hosted FLOSS fitness/workout, nutrition and weight tracker
Move the pagination parameters to constants.py file
Roland Geider673f7cd49ae3
diff --git a/wger/workout_manager/constants.py b/wger/workout_manager/constants.pyindex a3a07d125..ba13e74fc 100644--- a/wger/workout_manager/constants.py+++ b/wger/workout_manager/constants.py@@ -47,3 +47,9 @@ HTML_ATTRIBUTES_WHITELIST = {}HTML_STYLES_WHITELIST = ('text-decoration',)+++# Pagination+PAGINATION_OBJECTS_PER_PAGE = 25+PAGINATION_MAX_TOTAL_PAGES = 10+PAGINATION_PAGES_AROUND_CURRENT = 5diff --git a/wger/workout_manager/helpers.py b/wger/workout_manager/helpers.pyindex 51c0f5bd2..480e3cc07 100644--- a/wger/workout_manager/helpers.py+++ b/wger/workout_manager/helpers.py@@ -19,13 +19,17 @@ import jsonfrom django.core.paginator import Paginator, EmptyPage, PageNotAnInteger+from wger.workout_manager.constants import PAGINATION_OBJECTS_PER_PAGE+from wger.workout_manager.constants import PAGINATION_MAX_TOTAL_PAGES+from wger.workout_manager.constants import PAGINATION_PAGES_AROUND_CURRENT+def pagination(object_list,request_page,paginator_class=Paginator,- objects_per_page=25,- max_total_pages=10,- pages_around_current=5):+ objects_per_page=PAGINATION_OBJECTS_PER_PAGE,+ max_total_pages=PAGINATION_MAX_TOTAL_PAGES,+ pages_around_current=PAGINATION_PAGES_AROUND_CURRENT):'''Helper function to initialise the pagination.