[Django]-Django how to filter queryset based on nested many to many relations in one query

7👍

You can simply follow the relations using the double-underscore syntax. So:

desired_queryset = Product.objects.filter(children__countries= desired_country)

Leave a comment