如何在Django模板中连接字符串?
我想在Django模板标签中连接一个字符串,例如:
{% extend shop/shop_name/base.html %}这shop_name是我的变量,我想将其与其余路径连接起来。
假设我有shop_name=example.com并且我想要结果扩展shop/example.com/base.html。
回答:
用于:
{% with "shop/"|add:shop_name|add:"/base.html" as template %}{% include template %}
{% endwith %}
以上是 如何在Django模板中连接字符串? 的全部内容, 来源链接: utcz.com/qa/429102.html

