Django using model of one app into other app's model

1k views Asked by At

Salam and hi,

I am using django and breaking two parts of project in two apps. However there is a reference field of one table as foreign key of other in terms of db. So how can I use one app's model primary key as foreign key of another app's model? And if is not possible then should I just make single app of all such apps. I am actually thinking apps as different modules/components of project, may be I will be adding some apps in future.

thanks

1

There are 1 answers

4
Ignacio Vazquez-Abrams On BEST ANSWER

Either import the model from the other app, or refer to it by name in a string.