On corrige la navigation dans les fixed

This commit is contained in:
Jean-Marie Favreau 2025-01-25 18:25:39 +01:00
parent 509a9d5379
commit 483036bc33
2 changed files with 25 additions and 4 deletions

View File

@ -503,6 +503,27 @@ class DuplicatedEventsFilter(django_filters.FilterSet):
model = DuplicatedEvents
fields = []
def get_cleaned_data(self, name):
try:
return self.form.cleaned_data[name]
except AttributeError:
return {}
except KeyError:
return {}
def get_fixed_url(self):
if "fixed" in self.form.cleaned_data:
if self.form.cleaned_data["fixed"] is None:
return "fixed=unknown"
else:
if self.form.cleaned_data["fixed"]:
return "fixed=true"
else:
return "fixed=false"
else:
return ""
def fixed_qs(self, queryset, name, value):
return DuplicatedEvents.not_fixed_qs(queryset, value)

View File

@ -41,8 +41,8 @@
<footer>
<span>
{% if paginator_filter.has_previous %}
<a href="?page=1" role="button">&laquo; premier</a>
<a href="?page={{ paginator_filter.previous_page_number }}" role="button">&lt; précédent</a>
<a href="?page=1&{{ filter.get_fixed_url }}" role="button">&laquo; premier</a>
<a href="?page={{ paginator_filter.previous_page_number }}&{{ filter.get_fixed_url }}" role="button">&lt; précédent</a>
{% endif %}
<span>
@ -50,8 +50,8 @@
</span>
{% if paginator_filter.has_next %}
<a href="?page={{ paginator_filter.next_page_number }}" role="button">suivant &gt;</a>
<a href="?page={{ paginator_filter.paginator.num_pages }}" role="button">dernier &raquo;</a>
<a href="?page={{ paginator_filter.next_page_number }}&{{ filter.get_fixed_url }}" role="button">suivant &gt;</a>
<a href="?page={{ paginator_filter.paginator.num_pages }}&{{ filter.get_fixed_url }}" role="button">dernier &raquo;</a>
{% endif %}
</span>
</footer>