2015-01-28 20:35:27 +08:00
|
|
|
from django.core.paginator import Page, Paginator
|
2012-11-21 09:58:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
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)
|