Created
February 17, 2013 15:30
-
-
Save zodman/4971891 to your computer and use it in GitHub Desktop.
django paginator + boostrap css
This file contains hidden or 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
<div class="pagination pagination-centered"> | |
<ul> | |
{% if page_obj.has_previous %} | |
<li class="prev"> | |
<a href="{{url_suffix|default:"?page="}}{{page.previous_page_number}}">{{previous_label|default:"← Previous"}}</a> | |
</li> | |
{% else %} | |
<li class="prev disabled"> | |
<a href="#">{{previous_label|default:"← Previous"}}</a> | |
</li> | |
{% endif %} | |
{% for pagenum in page_obj.paginator.page_range %} | |
<li{% if page.number == pagenum %} class="active"{% endif %}> | |
<a href="{{url_suffix|default:"?page="}}{{pagenum}}">{{pagenum}}</a> | |
</li> | |
{% endfor %} | |
{% if page_obj.has_next %} | |
<li class="next"> | |
<a href="{{url_suffix|default:"?page="}}{{page.next_page_number}}">{{next_label|default:"Next →"}}</a> | |
</li> | |
{% else %} | |
<li class="next disabled"> | |
<a href="#">{{next_label|default:"Next →"}}</a> | |
</li> | |
{% endif %} | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment