1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-08 23:30:20 +02:00

Display mailing list address on team page

This commit is contained in:
Yohann D'ANELLO
2020-10-20 15:32:13 +02:00
parent 8c8ab4c0b7
commit b80f98ef43
3 changed files with 10 additions and 5 deletions

View File

@ -160,17 +160,14 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
mail_context = dict(team=self.object, 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)
send_mail("[Corres2math] Équipe validée", mail_plain, None,
[f"equipe-{self.object.trigram.lower()}@{os.getenv('SYMPA_HOST', 'localhost')}"],
html_message=mail_html)
send_mail("[Corres2math] Équipe validée", mail_plain, None, [self.object.email], 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)
send_mail("[Corres2math] Équipe non validée", mail_plain, None,
[f"equipe-{self.object.trigram.lower()}@{os.getenv('SYMPA_HOST', 'localhost')}"],
send_mail("[Corres2math] Équipe non validée", mail_plain, None, [self.object.email],
html_message=mail_html)
else:
form.add_error(None, _("You must specify if you validate the registration or not."))