开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜