mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 16:53:10 +00:00
Change pagination_nav.html to work without linkurl
pagination_nav.html received a linkurl parameter which has to be a url
name that get resolved to generate the link for next/previous. The thing
is that if the url to be resolved had parameters, these wouldn't be passed
and an exception would be thrown when trying to resolve it. A quick and
dirty fix is to just use {% url linkurl as link_to_use %} so link_to_use
will be empty and the currrent page url will be used.
This commit is contained in:
parent
e3cb37ca72
commit
2a4c371f51
1 changed files with 5 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{% load i18n %}
|
||||
{% url linkurl as url_to_use %}
|
||||
<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>
|
||||
|
|
@ -7,11 +8,11 @@
|
|||
{% 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 linkurl %}?q={{ query_string|urlencode }}&p={{ items.previous_page_number }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
|
||||
<a href="{{ url_to_use }}?q={{ query_string|urlencode }}&p={{ items.previous_page_number }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
|
||||
{% elif is_ajax %}
|
||||
|
||||
{% else %}
|
||||
<a href="{% url linkurl %}?p={{ items.previous_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
|
||||
<a href="{{ url_to_use }}?p={{ items.previous_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-left">{% trans 'Previous' %}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
|
@ -20,9 +21,9 @@
|
|||
{% 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 linkurl %}?q={{ query_string|urlencode }}&p={{ items.next_page_number }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
|
||||
<a href="{{ url_to_use }}?q={{ query_string|urlencode }}&p={{ items.next_page_number }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
|
||||
{% else %}
|
||||
<a href="{% url linkurl %}?p={{ items.next_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
|
||||
<a href="{{ url_to_use }}?p={{ items.next_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in a new issue