小编典典

如何在Django模板中连接字符串?

django

我想在Django模板标签中连接一个字符串,例如:

{% extend shop/shop_name/base.html %}

shop_name是我的变量,我想将其与其余路径连接起来。

假设我有shop_name=example.com并且我想要结果扩展shop/example.com/base.html


阅读 906

收藏
2020-03-26

共1个答案

小编典典

用于:

{% with "shop/"|add:shop_name|add:"/base.html" as template %}
{% include template %}
{% endwith %}
2020-03-26