I am passing a list uans
as a context for my template. I want to iterate over uans
to display values within it. My code is as follows:
{% for q in qlist %}
<span>You answered: {{ uans.{{forloop.counter0}} }}</span>
{% endfor %}
But I'm getting this error:
Could not parse the remainder: '{{forloop.counter0' from 'uans.{{forloop.counter0'
It works fine if I write uans.0
,, uans.1
and so on.
I want to use the forloop counter as an index.
I want to iterate over uans
only using the counter.
Please suggest a solution. Thanks :)