confirmation: Use render_to_string in send_confirmation.

No change in behavior; render_to_string(template, context) is a shortcut for
get_template(template).render(context). render_to_string is the function we
use to render email templates in the rest of the codebase.
This commit is contained in:
Rishi Gupta 2017-05-01 10:35:31 -07:00
parent 04fb86fff7
commit 30ba989c95
1 changed files with 3 additions and 3 deletions

View File

@ -108,10 +108,10 @@ class ConfirmationManager(models.Manager):
if additional_context is not None:
context.update(additional_context)
subject = loader.get_template(template_prefix + '.subject').render(context).strip()
body = loader.get_template(template_prefix + '.txt').render(context)
subject = loader.render_to_string(template_prefix + '.subject', context).strip()
body = loader.render_to_string(template_prefix + '.txt', context)
try:
html_content = loader.get_template(template_prefix + '.html').render(context)
html_content = loader.render_to_string(template_prefix + '.html', context)
except TemplateDoesNotExist:
html_content = None