* 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

@ -251,3 +251,6 @@ 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."
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):
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"]
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):