Django Category and Subcategory searches

后端 未结 3 498
闹比i
闹比i 2021-02-04 17:08

I\'m attempting to use a similar Category implementation to this one in the Django Wiki. I\'m wondering what the Django way of doing a search to pull all objects associated wit

3条回答
  •  囚心锁ツ
    2021-02-04 17:34

    If you are using django-categories, which uses MPTT then you can do the following:

    Entry.objects.filter(category__in=category.get_descendants(True))
    

提交回复
热议问题