How to work around lack of support for foreign keys across databases in Django

后端 未结 9 1400
生来不讨喜
生来不讨喜 2020-12-07 09:59

I know Django does not support foreign keys across multiple databases (originally Django 1.3 docs)

But I\'m looking for a workaround.

What doesn\'t work

9条回答
  •  情深已故
    2020-12-07 10:04

    You could make a view in the database that has the cross database query in it, then define the model for the view in a separate file to keep syncdb working.

    Happy programming. :)

提交回复
热议问题