如何在Django Feed中禁用自动转义? [英] How to disable autoescape in django feeds?

查看:84
本文介绍了如何在Django Feed中禁用自动转义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用django feed框架为我的网站组织rss feed。
我需要放置一些超链接来馈送项目,但是其中的全部都是
自动转义的(<替换为& lt;,依此类推)。
是否可以在我的Feed中保留标签(据我所知,我不能在Feed模板中使用
{%autoescape off%}标签)?
谢谢。

I use django feed framework to organize rss feeds for my website. I need to put some hyperlinks to feed items, but al of them are autoescaped ( "<" is replaced with "&lt;" and so on). Is it possible to keep tags in my feed (as I understand, I can't use {% autoescape off %} tag in feed templates)? Thanks.

推荐答案

在Django中自动HTML转义,然后尝试以下语法。数据是保存链接的变量

Read up on Automatic HTML escaping in Django and try the following syntax. Where data is the variable which holds your link

{{ data|safe }}

这篇关于如何在Django Feed中禁用自动转义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆