【问题标题】:In Django, is there a built in filter which can mark these as safe?在 Django 中,是否有内置过滤器可以将这些标记为安全?
【发布时间】:2011-05-28 13:08:22
【问题描述】:
> <strong>

HTML 标签等等(这 3 个只是示例)

是否有一个过滤器,我实际上在 Django 模板中呈现这些,但保持标签转义

【问题讨论】:

    标签: python django templates filter django-templates


    【解决方案1】:

    这应该有所帮助,但不与 Django 捆绑:

    http://djangosnippets.org/snippets/295/

    【讨论】:

      【解决方案2】:

      不,没有 - 如果您将某些内容标记为 safe,则不会转义任何内容。如果是unsafe,一切都会。没有办法说this content is varying degrees of safe - 所以如果你想要这个,你必须自己写。

      【讨论】:

        猜你喜欢
        • 2012-08-24
        • 2020-09-01
        • 1970-01-01
        • 1970-01-01
        • 2019-02-12
        • 1970-01-01
        • 2020-01-14
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多