Is it possible to filter by the ManyToMany fields? Suppose I have a Pizza model and a Topping model. Topping has a ManyToManyField pointing to Pizza. I now have an instance of a Pizza called mypizza.
I would like to now search for all Pizzas with the EXACT same Toppings as mypizza. Intuitively it would like something like this: Pizza.objects.filter(toppings=mypizza.toppings_set) This, naturally, does not work. Any ideas? I'm happy to do some fancy black magic with the models to make it work, or do a custom SQL clause. I just don't know enough SQL to do that. I'm also interested in reasonably alternative ways to model my data if I have a potentially very large set of Pizzas however a limited (although fairly lengthy, 20+) list of toppings that might change periodically. Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.