1

I am not sure whether I have discovered a bug, have my system misconfigured, or am just misunderstanding the {% cycle %} template tag in Django.

The manual provides the following sample code:

{% cycle 'row1' 'row2' as rowcolors silent %}{# no value here #}
{% for o in some_list %}
    <tr class="{% cycle rowcolors %}">{# first value will be "row1" #}
        ...
    </tr>
{% endfor %}

It clearly says that the first cycle declaration will output nothing, and the subsequent call will be the first iteration.

I am having the following issues: firstly, the second call outputs 'row2', which would be expected on the second call. Secondly, the subsequent {% cycle rowcolors %} calls don't output anything either!

Am I completely misunderstanding something, or does the tag not work as specified?

4

1 に答える 1