Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unescape html entities from JSON in Django templates

I'm getting the response from server that is escaped:

'item':'<b> Some Data </b>'

I pass such data to template useing item= json.loads(response)

By default django templates (in Google App Engine) escapes it further,
so its double escaped in results. I can use safe to remove one level of escaping like:

{{item|safe}}

How do i turn entities to their corresponding signs?

like image 658
Jask Avatar asked Oct 24 '13 15:10

Jask


1 Answers

You can do this:

{% autoescape off %}
  {{ your_text_var }}
{% endautoescape %}
like image 158
Rafael Zottesso Avatar answered Oct 06 '22 01:10

Rafael Zottesso