mirror of
https://github.com/django/django.git
synced 2024-12-29 12:36:08 +00:00
a8b70d251d
Backport of 0ed7d15563
from master
21 lines
559 B
Python
21 lines
559 B
Python
from django.core.paginator import Page, Paginator
|
|
|
|
|
|
class ValidAdjacentNumsPage(Page):
|
|
|
|
def next_page_number(self):
|
|
if not self.has_next():
|
|
return None
|
|
return super(ValidAdjacentNumsPage, self).next_page_number()
|
|
|
|
def previous_page_number(self):
|
|
if not self.has_previous():
|
|
return None
|
|
return super(ValidAdjacentNumsPage, self).previous_page_number()
|
|
|
|
|
|
class ValidAdjacentNumsPaginator(Paginator):
|
|
|
|
def _get_page(self, *args, **kwargs):
|
|
return ValidAdjacentNumsPage(*args, **kwargs)
|