diff --git a/participation/views.py b/participation/views.py index 8af0777..88509d5 100644 --- a/participation/views.py +++ b/participation/views.py @@ -259,17 +259,20 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView) payment = Payment.objects.get(registrations=registration, final=False) else: payment = None - mail_context = dict(domain=domain, registration=registration, team=self.object, payment=payment, - message=form.cleaned_data["message"]) - mail_plain = render_to_string("participation/mails/team_validated.txt", mail_context) - mail_html = render_to_string("participation/mails/team_validated.html", mail_context) + mail_context_plain = dict(domain=domain, registration=registration, team=self.object, payment=payment, + message=form.cleaned_data["message"]) + mail_context_html = dict(domain=domain, registration=registration, team=self.object, payment=payment, + message=form.cleaned_data["message"].replace('\n', '
')) + mail_plain = render_to_string("participation/mails/team_validated.txt", mail_context_plain) + mail_html = render_to_string("participation/mails/team_validated.html", mail_context_html) registration.user.email_user("[TFJM²] Équipe validée", mail_plain, html_message=mail_html) elif "invalidate" in self.request.POST: self.object.participation.valid = None self.object.participation.save() - mail_context = dict(team=self.object, message=form.cleaned_data["message"]) - mail_plain = render_to_string("participation/mails/team_not_validated.txt", mail_context) - mail_html = render_to_string("participation/mails/team_not_validated.html", mail_context) + mail_context_plain = dict(team=self.object, message=form.cleaned_data["message"]) + mail_context_html = dict(team=self.object, message=form.cleaned_data["message"].replace('\n', '
')) + mail_plain = render_to_string("participation/mails/team_not_validated.txt", mail_context_plain) + mail_html = render_to_string("participation/mails/team_not_validated.html", mail_context_html) send_mail("[TFJM²] Équipe non validée", mail_plain, None, [self.object.email], html_message=mail_html) else: