Friday, June 15, 2012

How to rework list of items (model instances page) in AdminSite?

Hello.
I try to make a simple structured model of data (categories for articles instances) and now cant find right way to reorder/rebuild list of elements, which rendering in admin site. Explain:
It's easy to switch ordering by 'ordering = ['field_name']', but it's just an order. I need to change algorithm which choose order of elements for render.
I need make tree such structure
-root_category_1
--child_category_1
--child_category_2
--child_category_3
-root_category_2
--child_category_1
--child_category_2
etc. In addition i need to order elemnts in that branches.  But i think it's not hard...
So how can i do it? In documentation i find nice way - use queryset function. But it should to return queryset... and i can't create structure what i need in one queryset... How can i solve it?

--
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/-/uHcAchkEh0sJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate