Just a thought, what about:

{% for k,v in mydict|order:'key' %}

or

{% for k,v in mydict orderby key %}

-Adam

On Nov 19, 10:55 am, Paweł Roman <romapa...@googlemail.com> wrote:
> When rendering dictionary, there is absolutely no way to display
> values sorted by keys. The only workaround is to copy all the dict
> items to a sortable structure e.g. list and pass the list to the
> template, instead of the dictionary.
>
> Why not introduce a new tag to solve this problem:
>
> I say, it should be called {%secretfor%} and the usage would be
>
> {%secretfor k,v in mydict %}
> ... do stuff....
> {%endsecretfor%}
>
> would work like sorted(mydict.keys)
>
> I won't stick with the tag name, but you see my point.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to