diff --git a/orchestra/contrib/bills/templates/bills/bill-notification.email b/orchestra/contrib/bills/templates/bills/bill-notification.email index 10bbbcdc..7a00022a 100644 --- a/orchestra/contrib/bills/templates/bills/bill-notification.email +++ b/orchestra/contrib/bills/templates/bills/bill-notification.email @@ -1,5 +1,5 @@ -{% if subject %}Bill {{ bill.number }}{% endif %} -{% if message %}Dear {{ bill.account.username }}, +{% if email_part == 'subject' %}Bill {{ bill.number }}{% endif %} +{% if email_part == 'message' %}Dear {{ bill.account.username }}, Find your {{ bill.get_type_display.lower }} attached. If you have any question, please write us at support@orchestra.lan diff --git a/orchestra/utils/mail.py b/orchestra/utils/mail.py index c159ee03..caa4589e 100644 --- a/orchestra/utils/mail.py +++ b/orchestra/utils/mail.py @@ -24,8 +24,10 @@ def render_email_template(template, context): 'scheme': url.scheme, 'domain': url.netloc, } - subject = render_to_string(template, {'subject': True}, context).strip() - message = render_to_string(template, {'message': True}, context).strip() + context['email_part'] = 'subject' + subject = render_to_string(template, context).strip() + context['email_part'] = 'message' + message = render_to_string(template, context).strip() return subject, message