Skip to content

Instantly share code, notes, and snippets.

@VovanR
Last active Dec 21, 2016
Embed
What would you like to do?
Django Bootstrap
{% if item.has_other_pages %}
<nav aria-label="Page navigation">
<ul class="pagination">
{% if item.has_previous %}
<li>
<a href="?page={{ item.previous_page_number }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
{% else %}
<li class="disabled">
<span>
<span aria-hidden="true">&laquo;</span>
</span>
</li>
{% endif %}
{% for i in item.paginator.page_range %}
{% if item.number == i %}
<li class="active">
<span>{{ i }} <span class="sr-only">(current)</span></span>
</li>
{% else %}
<li>
<a href="?page={{ i }}">{{ i }}</a>
</li>
{% endif %}
{% endfor %}
{% if item.has_next %}
<li>
<a href="?page={{ item.next_page_number }}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% else %}
<li class="disabled">
<span>
<span aria-hidden="true">&raquo;</span>
</span>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment