gpt4 book ai didi

python - 在 django 中的 urlencode 之前连接

转载 作者:太空宇宙 更新时间:2023-11-03 18:26:29 24 4
gpt4 key购买 nike

我是 django 新手,尝试在对变量和字符串进行 urlencode 之前将两者连接起来。

我已经有 #{profile.name|urlencode} 但需要类似 #{urlencode('string' + profile.name)}

非常感谢任何帮助

最佳答案

使用 addstringprofile.name 连接起来并为其分配变量:

{% with name="string"|add:profile.name %}
{{ name|urlencode }}
{% endwith %}

关于python - 在 django 中的 urlencode 之前连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23086991/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com