Django App Dependency Cycle

前端 未结 4 1451
耶瑟儿~
耶瑟儿~ 2020-12-08 01:28

I am in the middle of developing a Django application, which has quite complicated models (it models a university - courses, modules, lectures, students etc.)

I have

4条回答
  •  猫巷女王i
    2020-12-08 01:42

    If you're seeing circular model dependency I'm guessing that one of three things is happening:

    • You've defined an inverse relationship to one that's already defined (for instance both course has many lectures and lecture has one course) which is redundant in django
    • You have a model method in the wrong app
    • You're providing functionality in a model method that ought to be in a manager

    Maybe you could show us what's happening in these models and we can try to figure out why the problem is arising. Circular model dependency is rarely an indication that you need to combine two apps - it's more likely (though not definitely the case) that there's a problem with one of your model definitions.

    p.s. I am working on a similar django application, but my app structure is probably quite different to your's. I'd be happy to give you a high-level description of it if you're interested.

提交回复
热议问题