Skip to content

Instantly share code, notes, and snippets.

@VovanR
Last active December 21, 2016 13:55
Show Gist options
  • Save VovanR/65f78b3b22d66427b23337db73b1caf3 to your computer and use it in GitHub Desktop.
Save VovanR/65f78b3b22d66427b23337db73b1caf3 to your computer and use it in GitHub Desktop.
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