I have a template file in a Django app that is using data from the corresponding view using template variables. In the context of the view (which is returned as the page is rendered) I have a variable called len_values that stores the value of the end range of the loop. I currently have the for loop structured with this syntax:
<ul class= 'list-group'>
{% for i in range(0,len_values) %}
<li class = 'list-group-item' >
Artist: {{form_artistSelect}}
Location: {{venues.i.city}}, {{venues.i.region}}
Venue: {{venues.i.name}}
Date: {{dates.i}}
tickets status: {{ticket_statuses.i}}<br>
<a href = {{ticket_urls.i}}> ticket link </a>
{% if user.is_authenticated %}
<button id = 'invite' type='button' class= 'btn btn-info btn-lg' data-toggle = 'modal' data-target='#myModal' venue={{venues.i}} date={{dates.i}} ticket_url={{ticket_urls.i}} artist = {{form_artistSelect}}> Invite a friend </button>
<button id = 'save' type = 'button' class = 'btn btn-primary-outline'> Save Concert </button>
{% endif %}
</li>
{% endfor %}
</ul>
When I tried this code, I was getting the error: Could not parse the remainder: '(0,len_values)' from 'range(0,len_values)'
I've seen this old SO post which seems to be solving a similar issue but there isn't a conclusive answer based on the upvotes and the answers provided are old.
What would be the proper way to structure this for loop in the Django templating format