On reset le cache en cas d'ajout d'un nouveau tag

This commit is contained in:
Jean-Marie Favreau 2025-03-30 14:27:43 +02:00
parent 7d5b47e7ab
commit 74fe6cb86f

View File

@ -441,6 +441,8 @@ class EventForm(GroupFormMixin, ModelForm):
if self.is_moderation_expert and self.cleaned_data.get("new_tags") is not None: 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") 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 # when cloning an existing event, we need to copy the local image
if ( if (
@ -517,6 +519,8 @@ class EventModerateForm(ModelForm):
if self.is_moderation_expert and self.cleaned_data.get("new_tags") is not None: 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") 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"])) self.cleaned_data["tags"] = list(set(self.cleaned_data["tags"]))