From 9daf35b4aa06bd77b26eaca8e63786a05e27c198 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sat, 25 Nov 2023 14:41:08 +0100 Subject: [PATCH] =?UTF-8?q?*=20si=20on=20soumet=20une=20URL,=20la=20redire?= =?UTF-8?q?ction=20et=20le=20message=20d=C3=A9pendent=20du=20fait=20que=20?= =?UTF-8?q?l'on=20soit=20ou=20non=20connect=C3=A9:=20Fix=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/locale/fr/LC_MESSAGES/django.po | 5 ++++- src/agenda_culturel/views.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po b/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po index 512c255..39ed308 100644 --- a/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po +++ b/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po @@ -250,4 +250,7 @@ msgid "The end time cannot be earlier than the start time." msgstr "L'heure de fin ne peut pas être avant l'heure de début." msgid "The event has been submitted and will be published as soon as it has been validated by the moderation team." -msgstr "L'événement a été soumis et sera publié dès qu'il aura été validé par l'équipe de modération." \ No newline at end of file +msgstr "L'événement a été soumis et sera publié dès qu'il aura été validé par l'équipe de modération." + +msgid "The URL has been taken into account, and the associated event will be available in a few moments for validation." +msgstr "L'URL a été prise en compte, et l'événement associé sera disponible dans quelques instants pour validation." \ No newline at end of file diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index 610c9f5..4c5a579 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -388,7 +388,6 @@ class EventDetailView(UserPassesTestMixin, DetailView): class EventSubmissionFormView(FormView): form_class = EventSubmissionModelForm template_name = "agenda_culturel/import.html" - success_url = "/" def form_valid(self, form): form.save() @@ -398,10 +397,18 @@ class EventSubmissionFormView(FormView): def create_event(self, valid_data): url = valid_data["url"] - messages.success(self.request, _("The URL has been submitted and the associated event will be integrated in the agenda after validation.")) + if self.request.user.is_authenticated: + messages.success(self.request, _("The URL has been taken into account, and the associated event will be available in a few moments for validation.")) + else: + messages.success(self.request, _("The URL has been submitted and the associated event will be integrated in the agenda after validation.")) create_event_from_submission.delay(url) + def get_success_url(self, **kwargs): + if self.request.user.is_authenticated: + return reverse_lazy("view_all_events") + else: + return reverse_lazy("home") class EventFilterAdmin(django_filters.FilterSet):