On Sat, 2006-04-01 at 00:11 -0800, shredwheat wrote: > Using a hierarchy of models like the example shown on this cookbook > page. How do you query for the root level objects? Can it be done with > a single query? Or do I loop over and test on the Python side? > > http://code.djangoproject.com/wiki/CookBookCategoryDataModel
The root categories are the things without parents. So construct a filter that selects all the objects with a NULL parent_id field. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---