Django: Model name clash

前端 未结 1 1694
醉话见心
醉话见心 2021-01-13 19:28

I am trying to use different open source apps in my project. Problem is that there is a same Model name used by two different apps with their own model definition.

相关标签:
1条回答
  • 2021-01-13 19:52

    The problem is that both Satchmo and Pinax have a Contact model with a ForeignKey to User. Django tries to add a "contact_set" reverse relationship attribute to User for each of those ForeignKeys, so there is a clash.

    The solution is to add something like related_name="pinax_contact_set" as an argument to the ForeignKey in Pinax's Contact model, or similarly in the Satchmo Contact model. That will require editing the source directly for one or the other. You might be able to find a way to do it via monkeypatching, but I'd expect that to be tricky.

    0 讨论(0)
提交回复
热议问题