send email to team responsibles, not to the person joining the team

This commit is contained in:
Thomas Steen Rasmussen 2017-04-22 00:23:12 +02:00
parent 30c56afb83
commit 5c4487d513
2 changed files with 5 additions and 2 deletions

View file

@ -49,7 +49,7 @@ def send_new_membership_email(membership):
return _send_email( return _send_email(
text_template='emails/new_membership_email.txt', text_template='emails/new_membership_email.txt',
html_template='emails/new_membership_email.html', html_template='emails/new_membership_email.html',
recipient=membership.user.email, recipient=[resp.email for resp in membership.team.responsible],
formatdict=formatdict, formatdict=formatdict,
subject='New membership request for {} at {}'.format( subject='New membership request for {} at {}'.format(
membership.team.name, membership.team.name,

View file

@ -15,13 +15,16 @@ def _send_email(
attachment=None, attachment=None,
attachment_filename=None attachment_filename=None
): ):
if not isinstance(recipient, list):
recipient = [recipient]
try: try:
# put the basic email together # put the basic email together
msg = EmailMultiAlternatives( msg = EmailMultiAlternatives(
subject, subject,
render_to_string(text_template, formatdict), render_to_string(text_template, formatdict),
sender, sender,
[recipient], recipient,
[settings.ARCHIVE_EMAIL] [settings.ARCHIVE_EMAIL]
) )