Home how to use integer variable as subscript in Django template
Reply: 0

how to use integer variable as subscript in Django template

user551
1#
user551 Published in June 24, 2018, 3:27 am

I have a for loop in a Django template:

{% for i in no_of_lift_series_range %}
    {{ workout.lifts.series.i.activity_name }}
{% endfor %}

where this fails to output anything. The problem lies in the use of i. I know this, because this:

{% for i in no_of_lift_series_range %}
    {{ workout.lifts.series.0.activity_name }}
{% endfor %}

outputs what it is supposed to output. Why can't I use i in the way I want and how do I make this work?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.370106 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO