Created
February 2, 2017 17:49
-
-
Save adhoch/f8081b1519b04e1096a237c719559a2c to your computer and use it in GitHub Desktop.
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
<span class="step-links"> | |
{% if entries.has_previous %} | |
{% if entries.previous_page_number > 1 %} | |
<a href="?page=1"><<</a> | |
{% endif %} | |
<a href="?page={{ entries.previous_page_number }}"><</a> | |
{% endif %} | |
{% for i in entries.paginator.page_range %} | |
{% if entries.number < 3 %} | |
{% if i < 6 %} | |
<a href="?page={{ i }}" | |
{% if i == entries.number %} | |
class="current" | |
{% endif %}>{{ i }} | |
</a> | |
{% endif %} | |
{% elif entries.number > entries.paginator.num_pages|add:"-2" %} | |
{% if i > entries.paginator.num_pages|add:"-5" %} | |
<a href="?page={{ i }}" | |
{% if i == entries.number %} | |
class="current" | |
{% endif %}>{{ i }} | |
</a> | |
{% endif %} | |
{% elif i < entries.number|add:"3" and i > entries.number|add:"-3" %} | |
<a href="?page={{ i }}" | |
{% if i == entries.number %} | |
class="current" | |
{% endif %}>{{ i }} | |
</a> | |
{% endif %} | |
{% endfor %} | |
{% if entries.has_next %} | |
<a href="?page={{ entries.next_page_number }}">></a> | |
{% if entries.next_page_number < entries.paginator.num_pages %} | |
<a href="?page={{ entries.paginator.num_pages }}">>></a> | |
{% endif %} | |
{% endif %} | |
</span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment