Add pagination support for blog listing
This commit is contained in:
19
gergelypolonkaiweb/templates/paginator.html
Normal file
19
gergelypolonkaiweb/templates/paginator.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% if list.paginator.num_pages > 1 %}
|
||||
<div class="paginator">
|
||||
{% if list.number > 1 %}
|
||||
<a href="{% url view %}">First</a>
|
||||
{% endif %}
|
||||
{% if list.has_previous and list.number != 2 %}
|
||||
<a href="{% url view|add:"page" list.previous_page_number %}">Previous</a>
|
||||
{% endif %}
|
||||
{% for i in posts.paginator.page_range %}
|
||||
{% if list.number != i %}<a href="{% url view|add:"page" i %}">{% endif %}{{ i }}{% if list.number != i %}</a>{% endif %}
|
||||
{% endfor %}
|
||||
{% if list.has_next and list.number != list.paginator.num_pages|add:-1 %}
|
||||
<a href="{% url view|add:"page" list.next_page_number %}">Next</a>
|
||||
{% endif %}
|
||||
{% if list.number < list.paginator.num_pages %}
|
||||
<a href="{% url view|add:"page" list.paginator.num_pages %}">Last</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
Reference in New Issue
Block a user