Considering
<ul>
{% for l in [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h', 'i']] %}
{% for i in l %}
<li>
...
</li>
{% endfor %}
{% endfor %}
</ul>
in a Django template, what should I replace ...
with to get
1
2
3
4
5
6
7
8
9
i.e. how can I get a counter for a nest for loop where the lenght of the elements in the external loop aren't always the same?
Update
<ul>
{% for l in [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h', 'i']] %}
{% for i in l %}
<li>
{{forloop.counter}}
</li>
{% endfor %}
{% endfor %}
</ul>
gives
1
2
3
1
2
1
2
3
4
and
<ul>
{% for l in [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h', 'i']] %}
{% for i in l %}
<li>
{{forloop.parentloop.counter}}
</li>
{% endfor %}
{% endfor %}
</ul>
gives
1
1
1
2
2
3
3
3
3