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

后端 未结 4 676
心在旅途
心在旅途 2021-02-18 19:19

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 20:12

    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.

提交回复
热议问题