1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #362: Added per_page query parameter to control pagination page length

This commit is contained in:
Jeremy Stretch
2017-03-28 15:57:50 -04:00
parent e8fd0f3531
commit 28761fc960
3 changed files with 29 additions and 5 deletions

View File

@@ -5,7 +5,8 @@ from django.core.paginator import Paginator, Page
class EnhancedPaginator(Paginator):
def __init__(self, object_list, per_page, **kwargs):
per_page = getattr(settings, 'PAGINATE_COUNT', 50)
if not isinstance(per_page, int) or per_page < 1:
per_page = getattr(settings, 'PAGINATE_COUNT', 50)
super(EnhancedPaginator, self).__init__(object_list, per_page, **kwargs)
def _get_page(self, *args, **kwargs):