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
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
I read the django documentation for a simple many-to-many relationship and
I get it, but I'm stuck with this kind of complexity.
Each restaurant employs many chefs and serves many dishes.
Each chef can work for many restaurants and prepare many dishes.
Each dish can only be prepared by a singl
3 matches
Mail list logo