I have a var with the name 'seasons' that returns the number of seasons in a tv show and I know for a fact it does work and it returns it.
but I'm trying now to loop through it so if a tv show has 6 seasons it echos:
- season1, season2.. etc
but it doesn't work.
code :
{% for season in range(seasons) %}
<li rel="p{{season}}" class="activate-panel">الموسم {{ season }}</li>
{% endif %}
reference to how I got the number of seasons from db:
I've an Episode model that has a field with the name season_number, so for order to get the higest season number I searched for the episode with the highest season number
latest_episode = Episode.objects.order_by('-season_number').filter(is_published=True, tvshow=tvshow).first()
then I get the season with
seasons = latest_episode.season_number
and it does return a number indeed.