是否可以将静态路径作为变量传递给包含的模板?
我需要在我的页面上重复包含一个模板,但它总是带有不同的徽标。
例如:
{% with img={% static 'img/dashboards/belgium_flag.svg' %} %}
{% include 'dashboards/charts/country_block.html' %}
{% endwith %}
{% with img={% static 'img/dashboards/netherlands_flag.svg' %} %}
{% include 'dashboards/charts/country_block.html' %}
{% endwith %}
这不行..
除了创建一个模型来支持每个国家/地区实例的图像属性之外,还有其他解决方法吗?
开满天机
相关分类