Assuming that you are using the Category model in the same way as it is used on the page that you linked to, it would seem that the category βTVβ will be an instance of Category with zero parent Plasma 'and' LCD 'will be Category instances with the category βTVβ in as a parent.
>>> tv=Category(name="TV") >>> tv.save() >>> lcd=Category(name="LCD", parent=tv) >>> lcd.save() >>> plasma=Category(name="Plasma", parent=tv) >>> plasma.save()
Create multiple items
>>> vizio=Item(name="Vizio", category=lcd) >>> vizio.save() >>> plasmatron=Item(name="PlasmaTron", category=plasma) >>> plasmatron.save()
Get an item selection request
>>> items=Item.objects.filter(category__parent=tv)
or
>>>> items=Item.objects.filter(category__parent__name='TV')
Does this mean that it looks like the stage of what you need?
czarchaic
source share