I jumped into learning django recently.
I am rendering my template with citylist like,
{'citylist': Cities.objects.all()}
And want to reqroup on country in template (same as in django-docs) below:
{% regroup citylist by country as coutrylist %} <ul> {% for country in countrylist %} <li>{{ country.grouper }} <ul> {% for c in country.list %} <li>{{ c.name }}</li> {% endfor %} </ul> </li> {% endfor %} </ul>
but i get some unextpected results,
France Strasbourg Australia Penrith Sydney US Larsen Bay France Reims US Avenal
I dont think i am doing something wrong in my template. Or its a bug??
Problem is not in the code, but with data you are injecting in.
Change your context to
django-docs mentions that