I have an html-table generated in views.py. I want to show it in my html template. If I pass the html code as a string, symbols like "<" are automatically substituted to "& lt;", so instead of the table I see its html code. How can I solve this problem?
Just have to escape html var with |safe
filter as follows
In your views.py
....
context['your_html_variable '] = "<div><h1> Hello </h1></div>"
return render(request, 'template.html', context)
In your template.html
<body>
{{ your_html_variable|safe }}
</body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With