south migration: “database backend does not accept 0 as a value for AutoField” (mysql)

后端 未结 4 2161
轮回少年
轮回少年 2021-02-18 19:38

I\'m new to django and trying to have a Foreign key back to users for an assignee and reporter. But when i\'m trying to apply the change with South i get the error



        
4条回答
  •  暖寄归人
    2021-02-18 19:54

    If this happens when you run manage.py migrate (or manage.py syncdb in old versions), the reason maybe is that you have tried to add a foreign key to a model which uses AutoField as its primary key, and use 0 as the default value. Edit the migration file and remove the argument default=0 in AddField operations. It works for me in Django 1.10.

提交回复
热议问题