From 7c9d930e6fe8f5a21283c4c0db46f7cd4abc52e6 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 22 Dec 2024 16:08:58 +0100 Subject: [PATCH] =?UTF-8?q?quand=20on=20cr=C3=A9=C3=A9=20une=20copie=20loc?= =?UTF-8?q?ale,=20elle=20est=20mod=C3=A9r=C3=A9e=20en=20m=C3=AAme=20temps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #252 --- src/agenda_culturel/forms.py | 1 + .../templates/agenda_culturel/event_form.html | 2 +- src/agenda_culturel/views.py | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index d6d58ea..fe100fc 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -189,6 +189,7 @@ class EventForm(GroupFormMixin, ModelForm): old_local_image = CharField(widget=HiddenInput(), required=False) simple_cloning = CharField(widget=HiddenInput(), required=False) + cloning = CharField(widget=HiddenInput(), required=False) tags = MultipleChoiceField( label=_("Tags"), diff --git a/src/agenda_culturel/templates/agenda_culturel/event_form.html b/src/agenda_culturel/templates/agenda_culturel/event_form.html index fbc1128..dfe2649 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_form.html @@ -81,7 +81,7 @@ Duplication de {% else %} {{ form }}
Annuler - +
diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index 2907b38..df70345 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -320,7 +320,7 @@ class EventUpdateView( kwargs["is_simple_cloning"] = self.is_simple_cloning return kwargs - def form_valid(self, form): + def form_valid(self, form): form.instance.set_processing_user(self.request.user) return super().form_valid(form) @@ -339,6 +339,7 @@ class EventUpdateView( obj.save() result["other_versions"] = obj.other_versions result["status"] = Event.STATUS.PUBLISHED + result["cloning"] = True if self.is_simple_cloning: result["other_versions"] = None @@ -581,6 +582,9 @@ class EventCreateView(SuccessMessageMixin, CreateView): if form.cleaned_data['simple_cloning']: form.instance.set_skip_duplicate_check() + + if form.cleaned_data['cloning']: + form.instance.set_in_moderation_process() form.instance.import_sources = None form.instance.set_processing_user(self.request.user)