template.html
views.py
<!DOCTYPE html>
<html>
<body>
{% autoescape off %}
<h1>{{ heading|escape }}</h1>
<h1>{{ heading }}</h1>
{% endautoescape %}
<p>In views.py you can see what the heading variable looks like.</p>
<p>
<strong>Note:</strong>
Escaping HTML characters is a default setting in Django,
so we have to turn off autoescape in the example to see the difference.
</p>
</body>
</html>
from django.http import HttpResponse
from django.template import loader
def testing(request):
template = loader.get_template('template.html')
context = {
'heading': 'Hello <i>my</i> World!',
}
return HttpResponse(template.render(context, request))