I am using the django paginator in the template. Its working ok, but not good when there\'s large numbers of pages.
views.py:
def blog(request):
Gonna throw this in. I came up with it because it lets you know there are more pages on either side.
{% if page_obj.has_previous %}
{% else %}
{% endif %}
{% if page_obj.number|add:'-4' > 1 %}
- …
{% endif %}
{% for i in page_obj.paginator.page_range %}
{% if page_obj.number == i %}
- {{ i }} (current)
{% elif i > page_obj.number|add:'-5' and i < page_obj.number|add:'5' %}
- {{ i }}
{% endif %}
{% endfor %}
{% if page_obj.paginator.num_pages > page_obj.number|add:'4' %}
- …
{% endif %}
{% if page_obj.has_next %}
{% else %}
{% endif %}
And it looks like this: