Literal HTML in Django without using a variable? -
i've got bunch of html:
<div align="center" id="whatever"> <a href="http://www.whatever.com" style="text-decoration:none;color:black"> <img src="http://www.whatever.com/images/whatever.jpg" /> </a></div>
i want output literal html in browser, i.e. display above user. (edit: unfortunately don't have access django variables in template, due quirks of system i'm working on, can't use {{ | escape }}
.
is there way this, either using django template tags or special html tag, without having html-escape hand?
thanks!
yup, use escape
filter:
{{my_html|escape}}
edit: force_escape
:
{% filter force_escape %} ... html escaped ... {% endfilter %}
or, python:
from django.utils.html import escape escaped_html = escape(html_to_escape)
Comments
Post a Comment