title: How get all products into subcategories when filter through the parent category in django rest
body: <p>When I filter by subcategories, only those products that are directly related to this category are displayed, and when I filter, the parent category returns an empty one, but in fact there is a subcategory on this parent category and there are products on this category. I wanted to make sure that all products related to the parent categories were returned.</p>
  <p>in views.py</p>
  <pre><code>class ProductViewSet(viewsets.ModelViewSet):
      queryset = Product.objects.all()
      serializer_class = ProductsSerializer
      serializers = {
          'create': ProductsSerializer,
          'list': ProductDetailSerializer,
          'retrieve': ProductDetailSerializer,
          'default': ProductsSerializer,
          'add_favorite': FavouriteSerializer
      }
      filter_backends = (filters.DjangoFilterBackend, OrderingFilter)
      filter_fields = {
          'category__title': [&quot;in&quot;,]
      }
  
  </code></pre>
  <p>in models.py</p>
  <pre><code>class Category(MPTTModel):
      &quot;&quot;&quot;Categorizing posts&quot;&quot;&quot;
      title = models.CharField(max_length=128, verbose_name=&quot;Title&quot;, unique=True, default=None)
      description = models.TextField(verbose_name=&quot;Description&quot;, null=True, blank=True)
      parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children')
  
  
      class MPTTMeta:
          order_insertion_by = ['title']
  
  class Product(models.Model):
      title = models.CharField(max_length=255)
      category = models.ForeignKey(
          Category,
          on_delete=models.PROTECT,
          related_name=&quot;products&quot;,
          verbose_name=&quot;Category of a product&quot;
      )
  </code></pre>
  <p>in screen i have 2 category Parent and Child
  <a href="https://i.stack.imgur.com/YSJry.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YSJry.png" alt="enter image description here" /></a></p>
  <p>in screen when i filter by Child category
  <a href="https://i.stack.imgur.com/aRf9Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aRf9Q.png" alt="enter image description here" /></a></p>
  <p>in screen when i filter by Parent category and its response is empty
  <a href="https://i.stack.imgur.com/oDZt6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oDZt6.png" alt="enter image description here" /></a></p>
  <p>how can I fix this and get all the products from the subcategories through the parent category filter</p>