demos
demos

Reputation: 2630

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?

Upvotes: 9

Views: 14759

Answers (3)

lprsd
lprsd

Reputation: 87205

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

Use django.template.mark_safe()

Upvotes: 28

Daniel
Daniel

Reputation: 5024

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

Upvotes: 4

Martin Thurau
Martin Thurau

Reputation: 7654

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

I think this answers your querstion.

Upvotes: 2

Related Questions