In Django < 1.8 there was possibility to render template without autoescaping:
context = Context({...}, autoescape=False)
result = template.render(context)
In Django 1.8/1.9 I get following deprecation waring:
RemovedInDjango110Warning: render() must be called with a dict, not a Context.
Of course I can change the Context
instance to dict:
result = template.render({...})
But how can I force the render
function to turn off autoescape without using {% autoescape %}
tags in each email template (not every template in my project!)?
Only one solution comes to my mind: iterate over all context (dictionary) items and mark-them-safe (mark_safe
), but it doesn't seem elegant.