forked from MarseyWorld/MarseyWorld
fix template filter caching issue
parent
c16371c1ac
commit
636f78761c
|
@ -40,8 +40,8 @@ def template_asset(ctx, asset_path):
|
|||
|
||||
|
||||
@app.template_filter("change_page")
|
||||
def template_change_page(new_page):
|
||||
parsed = urlsplit(request.full_path)
|
||||
def template_change_page(new_page, url):
|
||||
parsed = urlsplit(url)
|
||||
query_dict = parse_qs(parsed.query)
|
||||
query_dict["page"] = new_page
|
||||
query_new = urlencode(query_dict, doseq=True)
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
|
||||
{% if start_point > 1 %}
|
||||
<li class="page-item">
|
||||
<small><a class="page-link" href="{{1|change_page|safe}}">1</a></small>
|
||||
<small><a class="page-link" href="{{1|change_page(request.full_path)|safe}}">1</a></small>
|
||||
</li>
|
||||
|
||||
{% if start_point == 3 %}
|
||||
<li class="page-item">
|
||||
<small><a class="page-link" href="{{2|change_page|safe}}">2</a></small>
|
||||
<small><a class="page-link" href="{{2|change_page(request.full_path)|safe}}">2</a></small>
|
||||
</li>
|
||||
{% elif start_point != 2 %}
|
||||
<li class="page-item">
|
||||
|
@ -40,14 +40,14 @@
|
|||
|
||||
{% for x in range(start_point, end_point+1) %}
|
||||
<li class="page-item">
|
||||
<small><a class="page-link {% if x == page %}active{% endif %}" href="{{x|change_page|safe}}">{{x}}</a></small>
|
||||
<small><a class="page-link {% if x == page %}active{% endif %}" href="{{x|change_page(request.full_path)|safe}}">{{x}}</a></small>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if end_point < num_pages %}
|
||||
{% if end_point == num_pages-2 %}
|
||||
<li class="page-item">
|
||||
<small><a class="page-link" href="{{(num_pages-1)|change_page|safe}}">{{num_pages-1}}</a></small>
|
||||
<small><a class="page-link" href="{{(num_pages-1)|change_page(request.full_path)|safe}}">{{num_pages-1}}</a></small>
|
||||
</li>
|
||||
{% elif end_point != num_pages-1 %}
|
||||
<li class="page-item">
|
||||
|
@ -56,7 +56,7 @@
|
|||
{% endif %}
|
||||
|
||||
<li class="page-item">
|
||||
<small><a class="page-link" href="{{num_pages|change_page|safe}}">{{num_pages}}</a></small>
|
||||
<small><a class="page-link" href="{{num_pages|change_page(request.full_path)|safe}}">{{num_pages}}</a></small>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue