Hi all I was struggling to turn a typical template dictionary iteration use case into a sorted dictionary iteration, and struggling to find any way of managing it.
Eg: {% for key, val in tdict.items %}....{% endfor %} After perusing docs, and the internet, it seemed like there was no straightforward way to manage to turn this into a sorted dictionary iteration, apart from altering the data structure outside the template. Finally, we looked at the source code for the dictsort filter, and it seems like this would work to produce the desired result: {% for key, val in tdict.items|dictsort:"0" %}....{% endfor %} and, indeed, it does the trick. However, the documentation for dictsort indicates that it is for sorting lists of dictionaries, and this behaviour seems to happen by coincidence. If I use this construct, is it likely to fail in the future, or is this actually intended usage? Cheers Tom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---