mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -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):
|
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
|
# Show first page, last page, next/previous two pages, and current page
|
||||||
n = self.number
|
n = self.number
|
||||||
pages_wanted = [1, n - 2, n - 1, n, n + 1, n + 2, self.paginator.num_pages]
|
pages_wanted = [1, n - 2, n - 1, n, n + 1, n + 2, self.paginator.num_pages]
|
||||||
|
Loading…
Reference in New Issue
Block a user