2👍
✅
Your relationship is going the wrong way. If a Product
can have multiple Item
s, make a ForeignKey
from Item
to Product
. With the ForeignKey
on Product
, you’re saying each product has exactly one Item
, but each Item
can belong to multiple Product
s.
The docs have more details and examples:
https://docs.djangoproject.com/en/1.7/topics/db/examples/many_to_one/
Source:stackexchange.com