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
You can use tagged cycle and resetcycle (new in Django 1.11) calls (from https://docs.djangoproject.com/en/1.11/ref/templates/builtins/#std:templatetag-resetcycle ):
{% for blog in blogs %}
{% cycle 'odd' 'even' as rowcolors silent %}
{% resetcycle rowcolors %}
{% for entry in blog.entries %}
{% cycle rowcolors %}
{{ entry.text }}
{% endfor %}
{% endfor %}