I seem to be blind at the moment, so I need to ask here. I want to sort a list of tuples which look like that
(id, parent_id, value)
So that it is a representation of the tree as a flattend list of list of tree nodes.
For example the input
(1, None, '...')
(3, 2', '...')
(2, 1, '...')
(4, 1, '...')
(5, 2, '...')
(6, None, '...')
Should sorted like that afterwards
(1, None, '...')
(2, 1, '...')
(3, 2', '...')
(5, 2, '...')
(4, 1, '...')
(6, None, '...')
Any hint would be highly appreciated. Thanks in advance.