1👍
✅
show.episodes = { "1" : 15 , "2" : 25 , "3" : 23}
Propose to iterate through your dict this way:
{% for season, series in show.episodes.items %}
Season {{ season }}
{% for _ in ''|center:series %}
Episode {{forloop.counter}}
{% endfor %}
{% endfor %}
It is ok for not big dictionaries. To process bigger dicts I propose to use custom template filters or tags. Or move processing logic to view function.
Docs for filter and tags
https://docs.djangoproject.com/en/3.2/howto/custom-template-tags/#custom-template-tags-and-filters
👤ale
Source:stackexchange.com