From 8955af7b02097774c8bc0ced9bcb6bd1f1833baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 30 Aug 2015 14:45:52 +0200 Subject: [PATCH] misc: add default-page-size site options, for backoffice pagination (#8135) --- wcs/admin/users.py | 3 ++- wcs/backoffice/management.py | 3 ++- wcs/forms/backoffice.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wcs/admin/users.py b/wcs/admin/users.py index 87c63b1..1facd91 100644 --- a/wcs/admin/users.py +++ b/wcs/admin/users.py @@ -306,7 +306,8 @@ class UsersDirectory(Directory): html_top('users', title = _('Users')) r = TemplateIO(html=True) - limit = int(get_request().form.get('limit', 20)) + limit = int(get_request().form.get('limit', + get_publisher().get_site_option('default-page-size') or 20)) offset = int(get_request().form.get('offset', 0)) ident_methods = get_cfg('identification', {}).get('methods', []) diff --git a/wcs/backoffice/management.py b/wcs/backoffice/management.py index d8f392f..3fdb8c2 100644 --- a/wcs/backoffice/management.py +++ b/wcs/backoffice/management.py @@ -536,7 +536,8 @@ class FormPage(Directory): if get_publisher().is_using_postgresql(): # only enable pagination in SQL mode, as we do not have sorting in # the other case. - limit = get_request().form.get('limit', 20) + limit = get_request().form.get('limit', + int(get_publisher().get_site_option('default-page-size') or 20)) else: limit = get_request().form.get('limit', 0) offset = get_request().form.get('offset', 0) diff --git a/wcs/forms/backoffice.py b/wcs/forms/backoffice.py index a05a128..d1d5d46 100644 --- a/wcs/forms/backoffice.py +++ b/wcs/forms/backoffice.py @@ -33,7 +33,7 @@ class FormDefUI(object): if not items: if offset and not limit: - limit = 20 + limit = int(get_publisher().get_site_option('default-page-size') or 20) items, total_count = self.get_listing_items( selected_filter, offset, limit, query, order_by, criterias=criterias) -- 2.5.1