Repository URL to install this package:
|
Version:
2.4.1rc1 ▾
|
{% load i18n %}
{% load wagtailadmin_tags %}
{% if not is_ajax %}
{% comment %}
HACK: This template expects to be passed a 'linkurl' parameter, containing a URL name
that can be reverse-resolved by the {% url %} tag with no further parameters.
Views that have parameters in their URL can work around this by passing a bogus
(but non-blank) URL name, which will return an empty string and produce a final URL
of the form "?q=123", implicitly preserving the current URL path.
Using the {% url ... as ... %} form of the tag ensures that this fails silently,
rather than throwing a NoReverseMatch exception.
If 'linkurl' is not passed, it will instead preserve the current URL and parameters,
just replacing the 'p' parameter.
{% endcomment %}
{% if linkurl %}
{% url linkurl as url_to_use %}
{% endif %}
{% endif %}
<div class="pagination">
<p>{% blocktrans with page_num=items.number total_pages=items.paginator.num_pages %}Page {{ page_num }} of {{ total_pages }}.{% endblocktrans %}</p>
<ul>
<li class="prev">
{% if items.has_previous %}
{% if is_ajax %}
<a href="#" data-page="{{ items.previous_page_number }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
{% elif is_searching %}
<a href="{{ url_to_use }}?q={{ query_string|urlencode }}&p={{ items.previous_page_number }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
{% elif not linkurl %}
<a href="?{% replace_page_param request.META.QUERY_STRING items.previous_page_number %}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
{% else %}
<a href="{{ url_to_use }}?p={{ items.previous_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
{% endif %}
{% endif %}
</li>
<li class="next">
{% if items.has_next %}
{% if is_ajax %}
<a href="#" data-page="{{ items.next_page_number }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
{% elif is_searching %}
<a href="{{ url_to_use }}?q={{ query_string|urlencode }}&p={{ items.next_page_number }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
{% elif not linkurl %}
<a href="?{% replace_page_param request.META.QUERY_STRING items.next_page_number %}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
{% else %}
<a href="{{ url_to_use }}?p={{ items.next_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
{% endif %}
{% endif %}
</li>
</ul>
</div>