Prevent the conversion of "&" to "& amp;" in jinja

I am repeating a dictionary in Python. Values ​​containing & are converted to & . How to stop this? It is displayed on the web page as follows:

  Hobbies & amp;  Leisure

My code is as follows:

 {% for k,v in vertical.iteritems() %} {value: '{{k}}', text: "{{v}}"}, {% endfor %} 
+4
source share
1 answer

You can try the safe Jinja filter.

http://jinja.pocoo.org/docs/templates/#safe

 {% for k, v in vertical.iteritems() %} {value: '{{ k|safe }}', text: "{{ v|safe }}"}, {% endfor %} 
+7
source

Source: https://habr.com/ru/post/1435395/


All Articles