Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vote): Fixed parameters on pagination actions #284

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "votepeloclima/base.html" %}
{% load static crispy_forms_filters compress thumbnail %}
{% load static crispy_forms_filters url_tags compress thumbnail %}

{% block head_css %}
{{ block.super }}
Expand Down Expand Up @@ -76,7 +76,7 @@ <h5 class="text-uppercase fw-bold text-center">Infelizmente nenhuma candidatura
</div>
<ul class="pagination justify-content-end mt-3">
<li class="page-item{% if not page_obj.has_previous %} disabled{% endif %}">
<a class="page-link"{% if page_obj.has_previous %} href="?page={{ page_obj.previous_page_number }}"{% endif %}>
<a class="page-link"{% if page_obj.has_previous %} href="?{% url_replace page=page_obj.previous_page_number %}"{% endif %}>
<i class="ds-paginator-previous"></i>
</a>
</li>
Expand All @@ -86,14 +86,14 @@ <h5 class="text-uppercase fw-bold text-center">Infelizmente nenhuma candidatura
</span> -->
{% for page_number in page_obj.paginator.page_range %}
<li class="page-item{% if page_number == page_obj.number %} active{% endif %}">
<a class="page-link"{% if page_number != page_obj.number %} href="?page={{ page_number }}"{% endif %}>
<a class="page-link"{% if page_number != page_obj.number %} href="?{% url_replace page=page_number %}"{% endif %}>
{{ page_number }}
</a>
</li>
{% endfor %}

<li class="page-item{% if not page_obj.has_next %} disabled{% endif %}">
<a class="page-link"{% if page_obj.has_next %} href="?page={{ page_obj.next_page_number }}"{% endif %}>
<a class="page-link"{% if page_obj.has_next %} href="?{% url_replace page=page_obj.next_page_number %}"{% endif %}>
<i class="ds-paginator-next"></i>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django import template

register = template.Library()

@register.simple_tag(takes_context=True)
def url_replace(context, **kwargs):
query = context['request'].GET.copy()
for key in kwargs.keys():
if key in query:
del(query[key])
query.update(kwargs)
return query.urlencode()
Loading