Django - Change a ForeignKey relation to OneToOne

前端 未结 3 445
感动是毒
感动是毒 2021-02-07 07:44

I am using South with my Django app. I have two models that I am changing from having a ForeignKey relation to having a OneToOneField relation. When I

3条回答
  •  我在风中等你
    2021-02-07 08:13

    You actually don't need a migration at all. OneToOne and ForeignKey relations have a compatible database schema under the hook: a simple column witht the other object ID in one of the table.

    Just fake the migration with migrate --fake if you don't want to enter in the trouble of telling south to ignore this change.

提交回复
热议问题