> > I suppose that "childrens" is a custom manager, can you show us, the > implementation of that manager? > Childrens it's just a related_items parameter for a field. This code from models.py
> class Categories(models.Model): > name = models.CharField(max_length=50) > path = models.SlugField(max_length=50) > parent = models.ForeignKey('self', null=True, blank=True, * > related_name='childrens'*) > order = models.IntegerField(default=1) > isShow = models.BooleanField(default=True) > By using category.childrens.all() i just check are child items exists... (any object have this category like 'parent') Only for performance "if len(category.childrens.all()):" -> "if > category.childrens.exist():" > Thx, for advice. > But your problem, it's rare. Print the type of the firs element of the > result list: > Type is a "class Category". So it's realy object... Now i understand so i wrong with identify my problem. I want to build HTML through the custom tag, and i cant get access for fields parametrs in custom tag script. In begin i suppose the problem appear when i put objects in list. But type(list[0]) show thet in list i have still object. I check in my template by {{item.field}} - it is show me right data, so in template i sill can get access for fields of an object. But when in my template i call my template tag, in template_tag code i can't get access for fields... code is below. In my template i do > {% load menu_builder %} > {{ list|BuildMenu }} > In menu_builder.py i have this code: > def BuildMenu(list): > html = '' > for item in list: > print item.path > return html > it's isnt realy function - just check... but i get a exception 'list' object has no attribute 'path' Exception Location: ..\templatetags\menu_builder.py in BuildMenu, line 7 Can you help with it? Where i make a wrong? -- 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/-/F0DN4I4B0MYJ. 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.