[Django]-Can I use Django's template language to construct HTML for use in a JSON response field?

4👍

There’s no need to “intercept” anything. Rendered Django templates are simply strings, and there is a handy shortcut to do exactly what you want:

from django.template.loader import render_to_string
rendered = render_to_string('my_template.html', {'foo': 'bar'})

Leave a comment