A simple and efficient paginator.
Jinja2 is supported via Coffin:
{% with paginate(request, my_queryset) as results %} {{ results.paging }} {% for result in results.objects %} {{ result }} {% endfor %} {{ results.paging }} {% endwith %}
Jinja2 is also supported via Jingo:
{% set paginate(request, my_queryset, per_page=25, endless=False, range_gap=3) as results %} {# results.paging is not implemented for Jingo, make your own template... #} {% for result in results.paginator.objects %} {{ result }} {% endfor %} {% endwith %}
Django templatetags require django-templatetag-sugar:
{% load paging_extras %} {% paginate my_queryset from request as results %} {{ results.paging }} {% for result in results.objects %} {{ result }} {% endfor %} {{ results.paging }}