在Django中转义HTML [英] Unescaping HTML in Django
本文介绍了在Django中转义HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有html编码的文本,其内容如下:
I have html encoded text which reads like this:
RT <a href="http://twitter.com/freuter">@freuter</a>...
我希望此显示为html但是我不确定是否有一个过滤器可以应用于此文本,以将html编码的文本转换回html ...
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 ...
有人可以帮忙吗?
推荐答案
如丹尼尔所说,请使用 {{tweet | safe}}
As Daniel says, use the {{ tweet|safe }}
filter in the html, or mark it safe from the views.
使用 django.template.mark_safe()
这篇关于在Django中转义HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文