Only display paginator if multiple pages.

This commit is contained in:
Bradley M. Kuhn 2015-03-04 15:28:44 -08:00
parent cdf9c67b42
commit f7425dc802
2 changed files with 2 additions and 4 deletions

View file

@ -26,8 +26,7 @@
{% if blog_entries.has_next %}<a class="next_page_button" href="?page={{ blog_entries.next_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">Next page (older) &raquo;</a>{% endif %} {% if blog_entries.has_next %}<a class="next_page_button" href="?page={{ blog_entries.next_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">Next page (older) &raquo;</a>{% endif %}
{% if blog_entries.has_previous %}<a href="?page={{ blog_entries.previous_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">&laquo; Previous page (newer)</a>{% endif %} {% if blog_entries.has_previous %}<a href="?page={{ blog_entries.previous_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">&laquo; Previous page (newer)</a>{% endif %}
</p> </p>
<p class="pagination_list">{% for pagenum in blog_entries.paginator.page_range %}{% ifequal pagenum blog_entries.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %} <p class="pagination_list">{% if blog_entries.num_pages > 1 %} {% for pagenum in blog_entries.paginator.page_range %}{% ifequal pagenum blog_entries.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %}{% endif %}</p>
</p>
<div class="clear"></div> <div class="clear"></div>
{% if date_list %} {% if date_list %}

View file

@ -31,8 +31,7 @@
{% if news.has_next %}<a class="next_page_button" href="?page={{ news.next_page_number }}">Next page (older) &raquo;</a>{% endif %} {% if news.has_next %}<a class="next_page_button" href="?page={{ news.next_page_number }}">Next page (older) &raquo;</a>{% endif %}
{% if news.has_previous %}<a href="?page={{ news.previous_page_number }}">&laquo; Previous page (newer)</a>{% endif %} {% if news.has_previous %}<a href="?page={{ news.previous_page_number }}">&laquo; Previous page (newer)</a>{% endif %}
</p> </p>
<p class="pagination_list">{% for pagenum in news.paginator.page_range %}{% ifequal pagenum news.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %} <p class="pagination_list">{% if blog_entries.num_pages > 1 %} {% for pagenum in blog_entries.paginator.page_range %}{% ifequal pagenum blog_entries.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %}{% endif %}</p>
</p>
</div> </div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>