Closed FiazAbrar closed 2 years ago
i should define foreign key inside each product model to room model?
above doesn't work because a product can be in many rooms, but above only permits a product to be in one room. I am secretly thinking if this is the case where you need generic foreign keys.
how about make the rooms explicit, like define models bedroom, bathroom, dining room. living room, etc and then add foreign key to them from inside each product model?
the thing with defining vanilla m2m field in either abstract product model or room model is that it creates a lot of intermediate table. Also this is not really a lone case, next up we have suppliers model, brand model etc etc. They all will have the same basic structure. So it's important now to make a "good decision".