python - How to put html in django template variables? -


i want put in pieces of html in template variables. this:

>>>t = django.template.template("<ul>{{ title }}<\ul>: {{ story }}") >>>c = django.template.context({"title":"this title",r"line 1.<br />line 2."}) >>>print t.render(c) <ul>this title<\ul>: line 1.&lt;br /&gt;line 2. 

i expected output this:

<ul>this title<\ul>: line 1.<br />line 2. 

how can put in html within template variables?

use safe filter, e.g.:

t = django.template.template("{{ title|safe }}<\ul>: {{ story|safe }}")


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -