I ran into an interesting "oversight" in the Django {% cycle %} template tag.  This has been listed as a bug, but I'm wondering if there is a workaround for it?
{% for r1 in range_0_2 %}
  {% for r2 in range_0_3 %}
   {{ r1 }}-{{ r2 }}-{{ cycle 'even' 'odd' }}
  {% endfor %}
{% endfor %}
This yields:
0-0-even
0-1-odd
0-2-even
1-0-odd
1-1-even
1-2-odd
It should yield:
0-0-even
0-1-odd
0-2-even
1-0-even
1-1-odd
1-2-even
                I have noticed the same problem in my templates.
You can use a workaround like the following:
{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}
                        I use "include" for inner loop content
{% regroup employee_bypos_list by pos as by_pos %}
{% for pos_set in by_pos %}
    <h2>«{{ pos_set.grouper.address }}»</h2>
    {% with pos_set.list as employee_list %}
        {% include 'website/employee/_staff_by_post.html' %}
    {% endwith %}
{% endfor %}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With