Re: Complicated relationships

2016-05-23 Thread Gergely Polonkai
I would make Restaurant.dishes a @property that returns all dishes the restaurant's chefs can make: return Dish.objects.filter(chef__restaurant=self) On May 23, 2016 14:46, "Jani Tiainen" wrote: > Something like > > Chef: > # Nothing special here, reverse relations will be done automatical

Re: Complicated relationships

2016-05-23 Thread Jani Tiainen
Something like Chef: # Nothing special here, reverse relations will be done automatically Dish: chef = ForeignKey(Chef) Restaurant: chefs = ManyToMany(Chef) dishes = ManyToMany(Dish) Of course, you need to build something to make sure that restaurant doesn't serve dishes that