Update redirection after intensity add

This commit is contained in:
Gregory Trullemans 2024-02-03 18:19:39 +01:00
parent d08291712e
commit f1a69276bf
1 changed files with 10 additions and 7 deletions

View File

@ -558,20 +558,23 @@ def note_create_or_update(request, note_id=None, gymnast_id=None):
url = request.build_absolute_uri( url = request.build_absolute_uri(
reverse("gymnast_details_tab", args=(new_note.gymnast.id, "event")) reverse("gymnast_details_tab", args=(new_note.gymnast.id, "event"))
) )
# content = (form.cleaned_data["informations"]) receivers = [
new_note.gymnast.user.email,
new_note.gymnast.email_trainer,
]
title = f"{new_note.gymnast} : Nouvelle note"
body = f"""<p>Bonjour,</p><p>Une nouvelle note vous a été envoyée. Vous pouvez la consulter en cliquant <a href='{url}'>ici</a>.</p>"""
send_mail( send_mail(
"Nouvelle note", title,
"Une nouvelle note vous a été envoyée", "Une nouvelle note vous a été envoyée",
settings.EMAIL_HOST_USER, settings.EMAIL_HOST_USER,
[new_note.gymnast.user.email, new_note.gymnast.email_trainer], receivers,
fail_silently=False, fail_silently=False,
html_message=f"""<p>Bonjour,</p> html_message=body + MAIL_FOOTER,
<p>Une nouvelle note vous a été envoyée. Vous pouvez la consulter en cliquant <a href='{url}'>ici</a>.</p>
{MAIL_FOOTER}""",
) )
return HttpResponseRedirect( return HttpResponseRedirect(
reverse("gymnast_details_tab", args=(new_note.gymnast.id, "event")) reverse("intensity_details", args=(new_note.id))
) )
return render(request, "notes/create.html", {"form": form}) return render(request, "notes/create.html", {"form": form})