2015-01-28 13:35:27 +01:00
|
|
|
from django.core.paginator import Page, Paginator
|
2012-11-21 02:58:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ValidAdjacentNumsPage(Page):
|
|
|
|
def next_page_number(self):
|
|
|
|
if not self.has_next():
|
|
|
|
return None
|
2017-01-21 14:13:44 +01:00
|
|
|
return super().next_page_number()
|
2012-11-21 02:58:14 +01:00
|
|
|
|
|
|
|
def previous_page_number(self):
|
|
|
|
if not self.has_previous():
|
|
|
|
return None
|
2017-01-21 14:13:44 +01:00
|
|
|
return super().previous_page_number()
|
2012-11-21 02:58:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ValidAdjacentNumsPaginator(Paginator):
|
|
|
|
def _get_page(self, *args, **kwargs):
|
|
|
|
return ValidAdjacentNumsPage(*args, **kwargs)
|