Last active
July 12, 2017 12:43
-
-
Save BenAtWide/6506926 to your computer and use it in GitHub Desktop.
Simple Bootstrap-styled pagination for Django class-based list view
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
{% if is_paginated %} | |
<div class="pagination"> | |
<ul> | |
{% if page_obj.has_previous %} | |
<li><a href="?page={{ page_obj.previous_page_number }}"> | |
{% else %} | |
<li class="disabled"><a href="#"> | |
{% endif %} | |
Prev</a></li> | |
{% for p in page_obj.paginator.page_range %} | |
<li class="{% if p == page_obj.number %}active{% endif %}"><a href="?page={{ p }}">{{ p }}</a></li> | |
{% endfor %} | |
{% if page_obj.has_next %} | |
<li><a href="?page={{ page_obj.next_page_number }}"> | |
{% else %} | |
<li class="disabled"><a href="#"> | |
{% endif %} | |
Next</a></li> | |
</ul> | |
</div> | |
{% endif %} | |
{% endblock content %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment