2 >>> from django.core.paginator import Paginator
3 >>> from pagination.templatetags.pagination_tags import paginate
4 >>> from django.template import Template, Context
6 >>> p = Paginator(range(15), 2)
7 >>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
8 [1, 2, 3, 4, 5, 6, 7, 8]
10 >>> p = Paginator(range(17), 2)
11 >>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
12 [1, 2, 3, 4, 5, 6, 7, 8, 9]
14 >>> p = Paginator(range(19), 2)
15 >>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
16 [1, 2, 3, 4, None, 7, 8, 9, 10]
18 >>> p = Paginator(range(21), 2)
19 >>> paginate({'paginator': p, 'page_obj': p.page(1)})['pages']
20 [1, 2, 3, 4, None, 8, 9, 10, 11]
22 >>> t = Template("{% load pagination_tags %}{% autopaginate var 2 %}{% paginate %}")
24 # WARNING: Please, please nobody read this portion of the code!
25 >>> class GetProxy(object):
26 ... def __iter__(self): yield self.__dict__.__iter__
27 ... def copy(self): return self
28 ... def urlencode(self): return u''
29 ... def keys(self): return []
30 >>> class RequestProxy(object):
36 >>> t.render(Context({'var': range(21), 'request': RequestProxy()}))
37 u'\\n<div class="pagination">...
39 >>> t = Template("{% load pagination_tags %}{% autopaginate var %}{% paginate %}")
40 >>> t.render(Context({'var': range(21), 'request': RequestProxy()}))
41 u'\\n<div class="pagination">...