##// END OF EJS Templates
Moved imageboard settings to the boards settings module. Added setting to disable archive
Moved imageboard settings to the boards settings module. Added setting to disable archive

File last commit:

r596:5657c06f default
r716:a6b9dd95 1.8.1 default
Show More
paginator.py
21 lines | 544 B | text/x-python | PythonLexer
from django.core.paginator import Paginator
__author__ = 'neko259'
PAGINATOR_LOOKAROUND_SIZE = 3
def get_paginator(*args, **kwargs):
return DividedPaginator(*args, **kwargs)
class DividedPaginator(Paginator):
lookaround_size = PAGINATOR_LOOKAROUND_SIZE
current_page = 0
def center_range(self):
index = self.page_range.index(self.current_page)
start = max(0, index - self.lookaround_size)
end = min(len(self.page_range), index + self.lookaround_size + 1)
return self.page_range[start:end]