468,305 Members | 1,433 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,305 developers. It's quick & easy.

Python treeview and recursion: help needed


I have a database with the following structure:

id name sublevel

for example

1 Node1 None
2 Node2 1
3 Node3 2
4 Node4 None
5 Node5 1
6 Node6 5
where Node1 and Node4 are treeview's master nodes, Node2 is a subnode of
Node1, Node3 is a subnode of Node2, Node5 is a subnode of Node1 and
Node6 a subnode of Node5 and so on

I need a recursive function to populate treeview and I'm stuck on this
function :confused:

I need a list where I have the master node with child node inside and if
a child node as others child nodes, I need thess nodes inside the child

Something like this:


I'm using django so I access the data as


and I can do something like

for a in all:
print a.id
print a.name

to get database value.

Any help is appreciated,


Jun 27 '08 #1
0 677

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Lowell Kirsh | last post: by
2 posts views Thread by MSNEWS | last post: by
7 posts views Thread by Mike | last post: by
reply views Thread by Mailing List SVR | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.