Alternate Row Coloring in Django Template with More Than One Set of Rows

前端 未结 7 1147
广开言路
广开言路 2020-12-07 14:37

Django templates offer the builtin tag cycle for alternating between several values at different points in a template (or for loop in a template) but this tag d

7条回答
  •  囚心锁ツ
    2020-12-07 15:18

    I end up doing so, with the forloop.counter0 - It works great!

    {% for product in products %}
    
        {% if forloop.counter0|divisibleby:4 %}
    {% endif %}
    Lorem Ipsum is simply dummy text
    {% endfor %}

提交回复
热议问题