10👍
✅
Dictionaries are unsorted.
You will need to convert your dict to a nested list in the view: the easiest way would be just to call sorted(bdays_all.items())
.
0👍
You also could create a new dictionary with sorted keys in your view:
dictio = {'a': 'orange', 'c':'apple', 'b': 'bannana'}
di = {}
for key in sorted(dictio.iterkeys()):
di[key] = dictio[key]
whit the result:
di = {'a': 'orange', 'b': 'bannana', 'c': 'apple'}
👤doru
- [Django]-What does the proxy_pass option in the NGINX config do?
- [Django]-Django: Add field to model formset
Source:stackexchange.com