Last active
August 29, 2015 14:07
-
-
Save cansadadeserfeliz/32ee3a083db76423508e to your computer and use it in GitHub Desktop.
Slicing pagination for Django (+Bootstrap styles)
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
{% if is_paginated %} | |
<div class="pagination-wrapper"> | |
<ul class="pager"> | |
{% if page_obj.has_previous %} | |
<li><a href="?page={{ page_obj.previous_page_number }}">Anterior</a></li> | |
{% endif %} | |
{% for page in page_numbers %} | |
{% if page %} | |
{% ifequal page page_obj.number %} | |
<li class="disabled"><a href="#">{{ page }}</a></li> | |
{% else %} | |
<li><a href="?page={{ page }}">{{ page }}</a></li> | |
{% endifequal %} | |
{% else %} | |
... | |
{% endif %} | |
{% endfor %} | |
{% if page_obj.has_next %} | |
<li><a href="?page={{ page_obj.next_page_number }}">Siguiente</a></li> | |
{% endif %} | |
</ul> | |
</div> | |
{% endif %} |
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
{% load paginator_tags %} | |
<!-- ... --> | |
{% get_pagination 2 1 %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment