vkr*_*ams 1 django templates urlencode
我在Apache下使用django.当我urlencode在django模板中使用时,它根本不会包含这样的东西{{value|urlencode}}这里是我完整的锚标签
<a href="/mysite/comment/{{i.comment_id|urlencode}}">Comment</a>
有人可以帮忙吗?有没有办法摆脱这个?
在此先感谢 - 维克拉姆
根据 django 文档 - / 在默认情况下不会转义。要转义 / 或其他字符,请使用可选参数:
{{ value|urlencode:"" }}
Run Code Online (Sandbox Code Playgroud)
更多详细信息 - https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#std:templatefilter-urlencode