I am referring to https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#with for Django 2.2 and https://docs.djangoproject.com/en/3.2/ref/templates/builtins/#with for 3.2
Can i use them this way?
{% with
thStyle="font-size: 1.4em;text-align: left;background-color: #A7C942;color: #fff;border: 1px solid #98bf21;padding: 5px 7px 4px 7px;"
tdStyle="font-size: 1.2em;border: 1px solid #98bf21;padding: 3px 7px 2px 7px;"
alttdStyle = "font-size: 1.2em;border: 1px solid #98bf21;padding: 3px 7px 2px 7px; background-color: #EAF2D3;"
%}
....
{% for key, value in some_list.items %}
{% with style = tdStyle # when forloop.counter|divisible:2 else it's alttdStyle %}
....
{% endwith %}
{% endfor %}
{% endwith %}
My plan is taht i need to use different td style depending whether the counter is divisible by 2 or not.
This is my logic. not confident if correct.