您的位置:首页 > Web前端 > HTML

Django html关闭转义两种种方式

2014-10-29 16:42 288 查看
1、使用拦截器:safe
http://l90z11.blog.163.com/blog/static/187389042201302331428884/
This will be escaped: {{ data }}
This will not be escaped: {{ data|safe }}
2、使用标签:autoescape
Auto-escaping is on by default. Hello {{ name }}

{% autoescape off %}
This will not be auto-escaped: {{ data }}.

Nor this: {{ other_data }}
{% autoescape on %}
Auto-escaping applies again: {{ name }}
{% endautoescape %}
{% endautoescape %}


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: