python - 模板文件中的 Django urldecode

标签 python django django-templates

Django 模板文件中的 urldecode 有什么办法吗?

就在urlencode对面或 escape

我想将 app%20llc 转换为 app llc

最佳答案

你必须写这样的东西而不是以前的答案,否则你将获得最大递归深度

from urllib import unquote
from django.template.defaultfilters import register
from urllib.parse import unquote #python3

@register.filter
def unquote_new(value):
    return unquote(value)

{{ raw|unquote_new }}

关于python - 模板文件中的 Django urldecode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5229054/

相关文章:

python - python请求中的Http重定向代码3XX

python - 可散列对象池

python - 您可以流式传输已到达 "hot"的帖子吗?

python - 如何使用 micropython 控制插入 BBC microbit 的水泵的速度

django - 如何使用 Django 和 tastypie 注册匿名用户?

ajax put 返回 500 内部服务器错误

Python - 覆盖 __init__ 的最干净方法,其中在 super() 调用之后必须使用可选的 kwarg?

python - 如何在ajax中使用django url?

python每3次迭代添加一个新的div

python - Django 中间件 process_template_response 方法未被调用