From 74fe6cb86f1449719922689fcad6f91f47889b2c Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 30 Mar 2025 14:27:43 +0200 Subject: [PATCH] On reset le cache en cas d'ajout d'un nouveau tag --- src/agenda_culturel/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index dd8ccc7..95a9329 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -441,6 +441,8 @@ class EventForm(GroupFormMixin, ModelForm): if self.is_moderation_expert and self.cleaned_data.get("new_tags") is not None: self.cleaned_data["tags"] += self.cleaned_data.get("new_tags") + # if a new tag is introduced, we clean the corresponding cache + Tag.clear_cache() # when cloning an existing event, we need to copy the local image if ( @@ -517,6 +519,8 @@ class EventModerateForm(ModelForm): if self.is_moderation_expert and self.cleaned_data.get("new_tags") is not None: self.cleaned_data["tags"] += self.cleaned_data.get("new_tags") + # if a new tag is introduced, we clean the corresponding cache + Tag.clear_cache() self.cleaned_data["tags"] = list(set(self.cleaned_data["tags"]))