我正在尝试以特定方式使用以下代码。
{% include 'your_template_here' with keyword='your_value_here' %}
我想做的是将我的论点store_list
传递到your_value_here
中,作为参数keyword
的论据。也就是说,它应该如下所示:
{% include 'your_template_here' with keyword={{ store_list }} %}
但是,它有一个语法错误。是否不允许在 {% include ' ' with=' ' %} 中传递查询集?
您需要从关键字中删除双花括号。
{% include 'your_template_here' with keyword=store_list %}
我想传递一个数组
{% include '/blocks/block-products-carousel.html' with
groups= [
{title: 'All', active: true},
{title: 'Power Tools', active: false},
{title: 'Hand Tools', active: false},
{title: 'Plumbing', active: false},
],