Re: Recursive function

2008-11-12 Thread bruno desthuilliers
On 12 nov, 14:56, gontran <[EMAIL PROTECTED]> wrote: > Could you be more explicite because I don't understand everything and I thought it was explicit enough. A custom tag is usually made of a parser function and a rendering node (cf relevant part of django's documentation), so I gave you a snipp

Re: Recursive function

2008-11-12 Thread gontran
Ok, thank you all for your help On 12 nov, 15:19, Steve Holden <[EMAIL PROTECTED]> wrote: > By all means use your custom tag. Inside the code for the tag, use a > template to generate the HTML. That's all! > > regards >  Steve > > gontran wrote: > > Could you be more explicite because I don't und

Re: Recursive function

2008-11-12 Thread gontran
Ok, thank you all for your help On 12 nov, 15:19, Steve Holden <[EMAIL PROTECTED]> wrote: > By all means use your custom tag. Inside the code for the tag, use a > template to generate the HTML. That's all! > > regards >  Steve > > gontran wrote: > > Could you be more explicite because I don't und

Re: Recursive function

2008-11-12 Thread gontran
Ok, thank you all for your help On 12 nov, 15:19, Steve Holden <[EMAIL PROTECTED]> wrote: > By all means use your custom tag. Inside the code for the tag, use a > template to generate the HTML. That's all! > > regards >  Steve > > gontran wrote: > > Could you be more explicite because I don't und

Re: Recursive function

2008-11-12 Thread gontran
Ok, thank you all for your help On 12 nov, 15:19, Steve Holden <[EMAIL PROTECTED]> wrote: > By all means use your custom tag. Inside the code for the tag, use a > template to generate the HTML. That's all! > > regards >  Steve > > gontran wrote: > > Could you be more explicite because I don't und

Re: Recursive function

2008-11-12 Thread Steve Holden
By all means use your custom tag. Inside the code for the tag, use a template to generate the HTML. That's all! regards Steve gontran wrote: > Could you be more explicite because I don't understand everything and > why not using my custom tag? (which works fine) > > On 12 nov, 14:43, bruno dest

Re: Recursive function

2008-11-12 Thread gontran
Could you be more explicite because I don't understand everything and why not using my custom tag? (which works fine) On 12 nov, 14:43, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 12 nov, 14:25, gontran <[EMAIL PROTECTED]> wrote:> On 12 nov, 13:22, Steve > Holden <[EMAIL PROTECTED]> wrot

Re: Recursive function

2008-11-12 Thread bruno desthuilliers
On 12 nov, 14:25, gontran <[EMAIL PROTECTED]> wrote: > On 12 nov, 13:22, Steve Holden <[EMAIL PROTECTED]> wrote: > > > gontran wrote: (snip - about using templates instead of building html in python code) > > > -> I'm using this function in a custom tag to build a menu > > > And is there a rule t

Re: Recursive function

2008-11-12 Thread gontran
Hello Steve, Maybe I'm wrong but I want to display this menu in all pages of my site, so by using a custom tag, I can display my menu without having to import my model in my different views. On 12 nov, 13:22, Steve Holden <[EMAIL PROTECTED]> wrote: > gontran wrote: > > Merci beaucoup! > > it wor

Re: Recursive function

2008-11-12 Thread David Christiansen
Hi gontran, Why not check out using one of the two tree libraries that are out there (django-mptt and treebeard)? They include functions for traversing trees already, and you save yourself a lot of work dealing with the schema stuff. We use django-mptt where I work to do exactly what you're desc

Re: Recursive function

2008-11-12 Thread Steve Holden
gontran wrote: > Merci beaucoup! > it works fine now. > >> Now, and while this is none of my problems, I'd seriously question the > decision of building html that way. This would be better done using > templates IMVHO. > > -> I'm using this function in a custom tag to build a menu And is there

Re: Recursive function

2008-11-12 Thread gontran
Merci beaucoup! it works fine now. >Now, and while this is none of my problems, I'd seriously question the decision of building html that way. This would be better done using templates IMVHO. -> I'm using this function in a custom tag to build a menu On 12 nov, 10:59, bruno desthuilliers <[EMAI

Re: Recursive function

2008-11-12 Thread bruno desthuilliers
On 12 nov, 09:22, gontran <[EMAIL PROTECTED]> wrote: > Hello, > > I've got a problem with a recursive function: > in my model, I have a class named myClass: each object in my class has > an id, a parentId, and a name. > I want to make a list of all my objects that looks like this: > > object1

Re: Recursive function

2008-11-12 Thread gontran
Just a correction: replace 'page' by 'element': def displayListObject(parentId, displayString): displayString += '' elements = myClass.objects.filter(parentId=parentId) for element in elements: if myClass.objects.filter(parentId=element.id): displayString += '' +