In Django 1.8+, the template’s render
method takes a dictionary for the context
parameter. Support for passing a Context
instance is deprecated, and gives an error in Django 1.10+.
In your case, just use a regular dict
instead of a Context
instance:
message = get_template('email_forms/direct_donation_form_email.html').render(ctx)
You may prefer to use the render_to_string
shortcut:
from django.template.loader import render_to_string
message = render_to_string('email_forms/direct_donation_form_email.html', ctx)
If you were using RequestContext
instead of Context
, then you would pass the request
to these methods as well so that the context processors run.
message = get_template('email_forms/direct_donation_form_email.html').render(ctx, request=request)
message = render_to_string('email_forms/direct_donation_form_email.html', ctx, request=request)