##// END OF EJS Templates
Added banner to show the site news. Returned the message middleware because it...
Added banner to show the site news. Returned the message middleware because it is required to add models over admin site

File last commit:

r722:0a4dc1c4 default
r1148:94091a42 default
Show More
paginator.py
21 lines | 544 B | text/x-python | PythonLexer
neko259
Code cleanup part 2
r722 __author__ = 'neko259'
neko259
Updated paginator for long page lists. Removed old get_threads method in the post manager
r596
neko259
Code cleanup part 2
r722 from django.core.paginator import Paginator
neko259
Updated paginator for long page lists. Removed old get_threads method in the post manager
r596
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]