Order a list to get a hierarchical order

Thibaut DIRLIK merwin.irc at gmail.com
Fri Jun 8 06:10:08 EDT 2012


Hi,

Having a list of objet with a parent_id attribute pointing to a parent, I
want to order this list like this :

[Parent #1, Child #1.1, Child#1.1.1, Child#1.1.2, Child#1.2, Parent #2,
Child #2.1, ...]

Any clue on how to do this ?

Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120608/c888151e/attachment.html>


More information about the Python-list mailing list