Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including HTML variable in Django template without escaping

I have html encoded text which reads like this:

RT <a href="http://twitter.com/freuter">@freuter</a>... 

I want this displayed as html but I am not sure if there is a filter which i can apply to this text to convert the html-encoded text back to html ...

can someone help?

like image 569
demos Avatar asked Jun 29 '10 07:06

demos


3 Answers

As Daniel says, use the {{ tweet|safe }} filter in the html, or mark it safe from the views.

Use django.template.mark_safe()

like image 78
lprsd Avatar answered Oct 22 '22 14:10

lprsd


Try the |safe filter if you want to render all HTML.

like image 30
Daniel Avatar answered Oct 22 '22 13:10

Daniel


See: How do I perform HTML decoding/encoding using Python/Django?

I think this answers your querstion.

like image 2
Martin Thurau Avatar answered Oct 22 '22 14:10

Martin Thurau