mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Simplified paginator when dealing with <=5 pages
This commit is contained in:
parent
bdff71db9e
commit
5716207ba6
@ -16,6 +16,10 @@ class EnhancedPage(Page):
|
||||
|
||||
def smart_pages(self):
|
||||
|
||||
# When dealing with five or fewer pages, simply return the whole list.
|
||||
if self.paginator.num_pages <= 5:
|
||||
return self.paginator.page_range
|
||||
|
||||
# Show first page, last page, next/previous two pages, and current page
|
||||
n = self.number
|
||||
pages_wanted = [1, n - 2, n - 1, n, n + 1, n + 2, self.paginator.num_pages]
|
||||
|
Loading…
Reference in New Issue
Block a user