9

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?

Flimm
  • 136,138
  • 45
  • 251
  • 267
demos
  • 2,630
  • 11
  • 35
  • 51

3 Answers3

28

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

Use django.template.mark_safe()

lprsd
  • 84,407
  • 47
  • 135
  • 168
  • 2
    But first check if the content is really safe. I would not blindly trust tweets directly from twitter's api for example. – bjunix May 14 '12 at 10:57
4

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

Daniel
  • 4,918
  • 4
  • 33
  • 34
2

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

I think this answers your querstion.

Community
  • 1
  • 1
Martin Thurau
  • 7,564
  • 7
  • 43
  • 80