Fixed send email template

This commit is contained in:
Marc Aymerich 2017-04-03 17:06:06 +00:00
parent 7c64197468
commit 35c7265bff
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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