* si on soumet une URL, la redirection et le message dépendent du fait que l'on soit ou non connecté: Fix #3

This commit is contained in:
Jean-Marie Favreau 2023-11-25 14:41:08 +01:00
parent c26140e088
commit 9daf35b4aa
2 changed files with 13 additions and 3 deletions

View File

@ -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." 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." 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." 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."

View File

@ -388,7 +388,6 @@ class EventDetailView(UserPassesTestMixin, DetailView):
class EventSubmissionFormView(FormView): class EventSubmissionFormView(FormView):
form_class = EventSubmissionModelForm form_class = EventSubmissionModelForm
template_name = "agenda_culturel/import.html" template_name = "agenda_culturel/import.html"
success_url = "/"
def form_valid(self, form): def form_valid(self, form):
form.save() form.save()
@ -398,10 +397,18 @@ class EventSubmissionFormView(FormView):
def create_event(self, valid_data): def create_event(self, valid_data):
url = valid_data["url"] 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) 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): class EventFilterAdmin(django_filters.FilterSet):