-
-
Save gustavcaves/ee08435e472981b1d89c34b3325be1e2 to your computer and use it in GitHub Desktop.
Menú de paginación con Bootstrap 4 para ListView en Django
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
<!-- Menú de paginación --> | |
{% if is_paginated %} | |
<nav aria-label="Page navigation"> | |
<ul class="pagination justify-content-center"> | |
{% if page_obj.has_previous %} | |
<li class="page-item "> | |
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">«</a> | |
</li> | |
{% else %} | |
<li class="page-item disabled"> | |
<a class="page-link" href="#" tabindex="-1">«</a> | |
</li> | |
{% endif %} | |
{% for i in paginator.page_range %} | |
<li class="page-item {% if page_obj.number == i %}active{% endif %}"> | |
<a class="page-link" href="?page={{ i }}">{{ i }}</a> | |
</li> | |
{% endfor %} | |
{% if page_obj.has_next %} | |
<li class="page-item "> | |
<a class="page-link" href="?page={{ page_obj.next_page_number }}">»</a> | |
</li> | |
{% else %} | |
<li class="page-item disabled"> | |
<a class="page-link" href="#" tabindex="-1">»</a> | |
</li> | |
{% endif %} | |
</ul> | |
</nav> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment