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

Fixes #2985: Fix pagination page length for rack elevations

This commit is contained in:
Jeremy Stretch
2019-03-11 12:51:03 -04:00
parent f4b85751bb
commit 7e70bfaacc
3 changed files with 11 additions and 3 deletions

View File

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