姜戈。通过 include 标签将数组传递给子模板

MrB*_*Win 3 python django django-templates

我正在尝试动态创建一个数组并将其传递给子模板:

{% include "template.html" with foo = ['one', 'two'] %}

但这行不通。有谁知道如何在父模板中生成数组然后将其传递给另一个模板?

itz*_*nTV 5

喜欢

{% include "template.html" with foo = 'one,two' %}
Run Code Online (Sandbox Code Playgroud)

并使用split