1. 对于单个内容在输出内容的标签 {{ content }} 修改为 {{content | safe }}。
2. 对于一段模板内容可以使用autoescape标签
{% autoescape off %} {{ data }} {% endautoescape %}
off 的意思是关闭对html的转义,而将off替换成on就表示进行html转义,默认进行html转义
注意:autoescape 具备继承性的,如果在父模版中定义了,则在子模版对应内容部分也存在此属性
1. 对于单个内容在输出内容的标签 {{ content }} 修改为 {{content | safe }}。
2. 对于一段模板内容可以使用autoescape标签
{% autoescape off %} {{ data }} {% endautoescape %}
off 的意思是关闭对html的转义,而将off替换成on就表示进行html转义,默认进行html转义
注意:autoescape 具备继承性的,如果在父模版中定义了,则在子模版对应内容部分也存在此属性
转载于:https://my.oschina.net/bklyy/blog/1814551