Hi (sorry for my bad english: p)
Imagine these models:
class Fruit(models.Model):
class Basket(models.Model):
fruits = models.ManyToManyField(Fruit)
Now I would like to get basket instances that apply to all fruits. The problem is that the following code returns basket instances associated with any fruit:
baskets = Basket.objects.filter(fruits__in=Fruit.objects.all())
baskets = Basket.objects.filter(fruits=Fruit.objects.all())
Does any solution solve this problem?
Many thanks.:)
source
share