My code looks like this:
context = Context()
context['some_values'] = ['a', 'b', 'c', 'd', 'e', 'f']
context['other_values'] = [4, 8, 15, 16, 23, 42]
I would like my template code to look like this:
{% for some in some_values %}
{% with index as forloop.counter0 %}
{{ some }} : {{ other_values.index }} <br/>
{% endwith %}
{% endfor %}
And I expect this to output:
a : 4 <br/>
b : 8 <br/>
c : 15 <br/>
d : 16 <br/>
e : 23 <br/>
f : 42 <br/>
Is it possible? I find that my c operator actually works, but then using this variable as a link does not work. I suspect that for {{other_values.index}} it does other_values ['index'] instead of other_values [index]. Is it possible?
slacy source
share