I know there are many dict to list questions on here but I can't quite find the information I need for my situation so I'm asking a new quetion.
Some background: I'm using a hierarchical package for my models and the built-in function which generates the tree structure outputs a nested loop to indicate parents, children, etc. My goal is to keep the logic in views and output a list so that I can simply loop over it in my templates.
Here is my data, in the tree structure:
1
-1.1
--1.1.1
---1.1.1.1
--1.1.2
-1.2
--1.2.1
--1.2.2
-1.3
Here is the nested dictionary I am getting as a result
{<Part: 1.1>:{<Part: 1.1.1>:{<Part: 1.1.1.1>: {}}, <Part: 1.1.2>: {}},<Part: 1.2>: {<Part: 1.2.1>: {},<Part: 1.2.2>: {}}, <Part: 1.3>: {}
}
or if you don't like the way I tried to break it up, here is what I get in a single line:
{<Part: 1.1>: {<Part: 1.1.1>: {<Part: 1.1.1.1>: {}}, <Part: 1.1.2>: {}}, <Part: 1.2>: {<Part: 1.2.1>: {}, <Part: 1.2.2>: {}}, <Part: 1.3>: {}}
What I'd like is to get:
[<Part: 1.1>, <Part: 1.1.1>, <Part: 1.1.1.1>, <Part: 1.1.2>, <Part: 1.2>, <Part: 1.2.2>, <Part: 1.2.1>, <Part: 1.3>,]
I've tried just iterating over the key in dict.items
but then I only get the top level keys (1.1, 1.2, 1.3)
What do I need to do to get deeper?
thanks!