Skip to content

Instantly share code, notes, and snippets.

@wozz
Created February 15, 2011 20:49
Show Gist options
  • Select an option

  • Save wozz/828215 to your computer and use it in GitHub Desktop.

Select an option

Save wozz/828215 to your computer and use it in GitHub Desktop.
pagination django
{% with list.number|add:"-5" as startnum %}
{% with list.number|add:"5" as endnum %}
{% for i in list.paginator.page_range %}
{% if i > startnum and i < endnum %}
<a href="?page={{ i }}">{{ i }}</a>&nbsp;
{% endif %}
{% endfor %}
{% endwith %}
{% endwith %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment