Created
May 4, 2017 18:10
-
-
Save augustogoulart/e947b141c915530ce176e0f1c216c1d2 to your computer and use it in GitHub Desktop.
Django pagination with bootstrap classes
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
| <ul class="pagination"> | |
| {% if page.has_previous %} | |
| <li><a href="?page={{ page.previous_page_number }}"><span>«</span></a></li> | |
| {% else %} | |
| <li class="disabled"><span>«</span></li> | |
| {% endif %} | |
| {% for i in paginator.page_range %} | |
| {% if page.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 page.has_next %} | |
| <li><a href="?page={{ page_obj.next_page_number }}">»</a></li> | |
| {% else %} | |
| <li class="disabled"><span>»</span></li> | |
| {% endif %} | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment