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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -