使用此代码:
{% for o in [1,2,3] %}
<div class="{% cycle 'row1' 'row2' %}">
{% cycle 'row1' 'row2' %}
</div>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
我得到一个TemplateSyntaxError:
Could not parse the remainder: '[1,2,3]' from '[1,2,3]'
Run Code Online (Sandbox Code Playgroud)
有没有办法在模板中构建列表?