Reputation: 590
I have raw html saved in my database contents. I want that to render that content, following is the way, I try -
from django.template import Context, Template
l = MyModel.objects.get(slug=current_slug)
tpl = Template(escape(l.content_text))
return HttpResponse(tpl.render(Context({})))
This renders html as string, and in the template I see <html>.....</html>
instead of the rendered content.
Let me know, how this can be fixed. Thanks.
Upvotes: 2
Views: 1444