I used the SortedDict  datastructure :)

https://docs.djangoproject.com/en/dev/ref/utils
or
/path/django-docs/ref/utils.html#django.utils.datastructures.SortedDict

On Wed, Nov 14, 2012 at 4:40 PM, Juan Pablo Tamayo <jtama...@gmail.com> wrote:
> Let me explain, I have a nested dictionary like:
>
> agenda = {'3': {'2012-11-11': <MyObject>, '2012-11-14': <MyObject>, ...},
>   '7': {'2012-11-9': <MyObject>, },
>   '2': {'2012-10-28': <MyObject>},
>   }
>
> And I want to access it by specifying the two keys. I've red that i must
> access the dict like (where attribute is an attribute of <MyObject>:
>
> {% for k, a_dict in agenda.items %}
>   {{ k }}
>   {% for k2, v in a_dict.items %}
>     {{ k }}-{{ k2 }}-{{ v.attribute }}
>   {% endfor %}
> {% endfor %}
>
> But, whats the point of using dicts if I have to access the values in
> whatever order the <Dict>.items() gives me the keys and values?
>
> What if I need to access these values in a specified order? (for the outer
> dict AND the inner ones)
>
> Is there a way to access a two-dimensional container IN AN PRE-SPECIFIED
> ORDER?
>
> Thaks for any advise.
>
> pablete
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/y5GJm9E1D4YJ.
> 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.



-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
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.

Reply via email to