This may not be a question, but how do you use Django functionality {% cycle %}or something similar when you're not in a loop? In particular, I have an HTML table that I write manually, as this is not what you need to do in the loop. I want the lines to alternate, for example:
<tr class="{% cycle 'even' 'odd'%}"></tr>
<tr class="{% cycle 'even' 'odd'%}"></tr>
<tr class="{% cycle 'even' 'odd'%}"></tr>
But I do not use a loop, so this always results in even. I do not need a situation where I want to insert one line later, and then I have to change the classes of all the lines under it manually. Am I just a little girl? How would you switch without being in a loop?
source
share