Skip to content

Instantly share code, notes, and snippets.

@dimitrov
Created May 13, 2015 08:28
Show Gist options
  • Save dimitrov/a2fe2313ae4a01b6fbf5 to your computer and use it in GitHub Desktop.
Save dimitrov/a2fe2313ae4a01b6fbf5 to your computer and use it in GitHub Desktop.
<nav>
<ul class="pagination pull-right">
<li {% if not page_obj.has_previous %}class="disabled"{% endif %}>
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
{% else %}
<a href="#" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
{% endif %}
</li>
{% for page in page_obj.paginator.page_range %}
<li {% if page_obj.number == page %}class="active"{% endif %}><a href="?page={{ page }}">{{ page }} <span class="sr-only">(current)</span></a></li>
{% endfor %}
<li {% if not page_obj.has_next %}class="disabled"{% endif %}>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
{% else %}
<a href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
{% endif %}
</li>
</ul>
</nav>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment