django template to populate bootstrap rows and columns

后端 未结 5 609
温柔的废话
温柔的废话 2020-12-05 01:14

So here\'s my problem: I\'ve got a bunch of instances of a class. I would like to have a sort of table of these instance objects, so that there is a maximum of six in every

5条回答
  •  半阙折子戏
    2020-12-05 01:49

    Since forloop.counter starts the index with 1, divisibleby 3 does not work. So use forloop.counter0 instead.

    {% for product in all_products %} {% if forloop.counter0|divisibleby:3 %}

    {% endif %}
    {% endfor %}

提交回复
热议问题