Created
December 14, 2012 04:56
-
-
Save erickgnavar/4282778 to your computer and use it in GitHub Desktop.
Django pagination with bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load common_tags %} | |
<!--Pagination--> | |
<div class="pagination pagination-centered"> | |
<ul> | |
{% if page_obj.has_previous %} | |
<li><a href="?page={{ page_obj.previous_page_number }}">«</a></li> | |
{% else %} | |
<li class="disabled"><a href="">«</a></li> | |
{% endif %} | |
{% for page_number in page_obj.paginator.num_pages|to_range %} | |
{% if page_number == page_obj.number %} | |
<li class="active"><a href="?page={{ page_obj.number }}">{{ page_number }}</a></li> | |
{% else %} | |
<li><a href="?page={{ page_number }}">{{ page_number }}</a></li> | |
{% endif %} | |
{% endfor %} | |
{% if page_obj.has_next %} | |
<li><a href="?page={{ page_obj.next_page_number }}">»</a></li> | |
{% else %} | |
<li class="disabled"><a href="">»</a></li> | |
{% endif %} | |
</ul> | |
</div> | |
<!--End Pagination--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment