Skip to content
Advertisement

Django Foreign Key to Multiple Models

Is there a way to make one model be able to foreignkey to more than one model? For example

JavaScript

Advertisement

Answer

So you want to connect both the model jeans and shirt with cloth so you an connect like that I am afraid that’s not possible which you are trying but you can connect both model like that

JavaScript

or the second way is connect the cloth with both the model

JavaScript

I know this is not the answer you were expecting but according to me this is the only ways two interconnect model

Advertisement