By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,441 Members | 1,731 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,441 IT Pros & Developers. It's quick & easy.

Re: Python treeview and recursion: help needed

P: n/a
Il giorno ven, 23/05/2008 alle 09.20 +0200, Mailing List SVR ha scritto:

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:

to get database value.

Any help is appreciated,


only for the records attacched is a working solution, maybe not the best
one but a working one,

Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.