Ticket #2574: paginator.diff

File paginator.diff, 1.4 KB (added by grimboy, 18 years ago)
Line 
174a75,100
2>
3> def page_list(self, page, page_list_surround, page_list_edges):
4> page_list = []
5> if page_list_surround:
6> surround_start = page-page_list_surround
7> surround_end = (page+page_list_surround)+1
8> if page_list_edges:
9> page_list.extend(range(1, page_list_edges+1))
10> if page_list[-1] < surround_start:
11> page_list.append("sep")
12> if surround_start <= 1:
13> surround_start = 1
14> else:
15> page_list.append("sep")
16> if surround_end > self.pages-page_list_edges:
17> surround_end = (self.pages-page_list_edges)+1
18> page_list.extend(range(surround_start, surround_end))
19> if page_list_edges:
20> if not self.pages-page_list_edges == surround_end:
21> page_list.append("sep")
22> page_list.extend(range(self.pages-page_list_edges, self.pages))
23> elif surround_end-1 != self.pages:
24> page_list.append("sep")
25> else:
26> page_list.extend(range(1, self.pages+1))
27> return page_list
2878c104,107
29< self._hits = self.query_set.count()
30---
31> try:
32> self._hits = self.query_set.count()
33> except TypeError:
34> self._hits = len(self.query_set)
Back to Top