Django importing model issue
I am editing my user model, and I want to place a foreign key to a class in another model, that is in a different app. How would I go about importing it?
Tree:
/project/myapp/model1.py
/pro开发者_如何转开发ject/myapp2/model2.py
can i simply just say:
from myapp2 import model2
or do I need to edit something in the settings?
Thank you.
Well, the idea is that when you import you should be importing project.app.folders.there.after instead of just the relative paths. So if you put project.myapp2 it should get to the right directory and import correctly.
精彩评论