在bootstrap4行上循环动态内容

时间:2017-11-15 08:19:23

标签: python django twitter-bootstrap django-templates

我想我有一个关于使用for循环和索引的简单问题

我正在尝试使用bootstrap4和Python(Django)设置动态行和列。

我正在遍历列表,我想要做的是在最多3列的列中打印每个值。

我尝试使用:

  {% for member in project.team_id.members.all %}
      {% if loop.index % 3 == 0 %}
      <div class="row">
      {% endif%} 
...
...
...
...

  {% if (loop.index % 3 == 0 or loop.last) %}
        </div>
        {% endif %}

        {% endfor %}

但它不起作用.. 你能帮我解决一下吗? 谢谢你;)

0 个答案:

没有答案
相关问题