mirror of
https://github.com/django/django.git
synced 2024-11-24 02:47:35 +01:00
19 lines
503 B
Python
19 lines
503 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().next_page_number()
|
|
|
|
def previous_page_number(self):
|
|
if not self.has_previous():
|
|
return None
|
|
return super().previous_page_number()
|
|
|
|
|
|
class ValidAdjacentNumsPaginator(Paginator):
|
|
def _get_page(self, *args, **kwargs):
|
|
return ValidAdjacentNumsPage(*args, **kwargs)
|