2017-04-23 20:04:58 +00:00
|
|
|
from utils.email import add_outgoing_email
|
2017-04-18 18:46:57 +00:00
|
|
|
import logging
|
|
|
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
|
|
|
|
|
|
|
|
|
|
|
def send_add_membership_email(membership):
|
|
|
|
formatdict = {
|
|
|
|
'team': membership.team.name,
|
|
|
|
'camp': membership.team.camp.title
|
|
|
|
}
|
|
|
|
|
2017-04-23 20:04:58 +00:00
|
|
|
return add_outgoing_email(
|
2017-04-18 18:46:57 +00:00
|
|
|
text_template='emails/add_membership_email.txt',
|
|
|
|
html_template='emails/add_membership_email.html',
|
|
|
|
recipient=membership.user.email,
|
|
|
|
formatdict=formatdict,
|
|
|
|
subject='Team update from {}'.format(membership.team.camp.title)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def send_remove_membership_email(membership):
|
|
|
|
formatdict = {
|
|
|
|
'team': membership.team.name,
|
|
|
|
'camp': membership.team.camp.title
|
|
|
|
}
|
|
|
|
|
|
|
|
if membership.approved:
|
|
|
|
text_template = 'emails/remove_membership_email.txt',
|
|
|
|
html_template = 'emails/remove_membership_email.html'
|
|
|
|
else:
|
|
|
|
text_template = 'emails/unapproved_membership_email.txt',
|
|
|
|
html_template = 'emails/unapproved_membership_email.html'
|
|
|
|
|
2017-04-23 20:04:58 +00:00
|
|
|
return add_outgoing_email(
|
2017-04-18 18:46:57 +00:00
|
|
|
text_template=text_template,
|
|
|
|
html_template=html_template,
|
|
|
|
recipient=membership.user.email,
|
|
|
|
formatdict=formatdict,
|
|
|
|
subject='Team update from {}'.format(membership.team.camp.title)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def send_new_membership_email(membership):
|
|
|
|
formatdict = {
|
|
|
|
'team': membership.team.name,
|
|
|
|
'camp': membership.team.camp.title
|
|
|
|
}
|
|
|
|
|
2017-04-23 20:04:58 +00:00
|
|
|
return add_outgoing_email(
|
2017-04-18 18:46:57 +00:00
|
|
|
text_template='emails/new_membership_email.txt',
|
|
|
|
html_template='emails/new_membership_email.html',
|
2017-05-21 15:23:48 +00:00
|
|
|
recipients=membership.team.responsible,
|
2017-04-18 18:46:57 +00:00
|
|
|
formatdict=formatdict,
|
|
|
|
subject='New membership request for {} at {}'.format(
|
|
|
|
membership.team.name,
|
|
|
|
membership.team.camp.title
|
|
|
|
)
|
|
|
|
)
|