diff --git a/src/agenda_culturel/templates/agenda_culturel/filter-inc.html b/src/agenda_culturel/templates/agenda_culturel/filter-inc.html
index 8febc83..2b7d162 100644
--- a/src/agenda_culturel/templates/agenda_culturel/filter-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/filter-inc.html
@@ -32,7 +32,7 @@
-{% if filter.is_active %}
+{% if filter.is_resetable %}
{% picto_from_name "x-circle" %} Supprimer le filtre
{% endif %}
diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py
index 3dad4c8..44a7be4 100644
--- a/src/agenda_culturel/views.py
+++ b/src/agenda_culturel/views.py
@@ -285,6 +285,31 @@ class EventFilter(django_filters.FilterSet):
else:
return ""
+
+ def is_resetable(self, only_categories=False):
+ if only_categories:
+ return len(self.get_cleaned_data("category")) != 0
+ else:
+ if self.request.user.is_authenticated:
+ if (
+ len(self.get_cleaned_data("status")) != 1
+ or
+ self.get_cleaned_data("status")[0] != Event.STATUS.PUBLISHED
+ ):
+ return True
+ else:
+ if (
+ len(self.get_cleaned_data("status")) != 0
+ ):
+ return True
+ return (
+ len(self.get_cleaned_data("category")) != 0
+ or len(self.get_cleaned_data("tags")) != 0
+ or len(self.get_cleaned_data("exclude_tags")) != 0
+ or len(self.get_cleaned_data("recurrences")) != 0
+ or len(self.get_cleaned_data("city")) != 0
+ )
+
def is_active(self, only_categories=False):
if only_categories:
return len(self.get_cleaned_data("category")) != 0