edecor / Backend

0 stars 0 forks source link

tag products with rooms #44

Closed FiazAbrar closed 2 years ago

FiazAbrar commented 2 years ago
FiazAbrar commented 2 years ago

i should define foreign key inside each product model to room model?

FiazAbrar commented 2 years ago

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.

FiazAbrar commented 2 years ago

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?

FiazAbrar commented 2 years ago

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".