Hello. 
I need a bit help with my code.
I write a function for menu building, which should create a list of 
objects, for designing it in html code.
Code of function below:

> def BuildList(categories):
>     list = []
>     for category in categories:
>         if len(category.childrens.all()):
>             list.append(category)
>             list.append(BuildList(category.childrens.all()))
>         else :
>             list.append(category)
>     return list
>
 
I call this function for a list of categories, like this:

> list = BuildList(Categories.objects.filter(parent = None))
>
My function work right, but in list i get not an objects, my values have 
only name of a categories. I thought it happens couse in my Category model 
in __unicode__  function i place a 'return self.name', and when i call my 
categories in function - it return just name. :(
What i should do for get full objects in my list? With full collection of 
parameters.
I suppose this question is easy, but i just start to learn python and 
django.
Thx for you time and answers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LwmJH2ZcRcwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to