[英]Field 'id' doesn't have a default value django-registration
I recently loaded all of the django-registration tables from sqlite into a mysql database. 我最近将所有的django注册表从sqlite加载到mysql数据库中。 It works fine for logging in users, but now when I try to register a user I get this error:
它适合登录用户,但是现在当我尝试注册用户时,出现此错误:
Warning at /accounts/register/
Field 'id' doesn't have a default value
I tried using this line to make the id field auto increment but I'm still getting the error. 我尝试使用此行使id字段自动递增,但仍然出现错误。
ALTER TABLE auth_user MODIFY id INT(12) NOT NULL AUTO_INCREMENT;
Thanks for the help. 谢谢您的帮助。
Edit: I ended up deleting all of the dables and using manage.py syncdb
to recreate them although that isn't really a solution. 编辑:我最终删除了所有的数据,并使用
manage.py syncdb
来重新创建它们,但这并不是真正的解决方案。
You probably have incorrect table structure. 您的表格结构可能不正确。 Try to:
尝试:
manage.py syncdb
on test project. manage.py syncdb
。 auth_user
structure between current and test project. auth_user
结构。 For example compare create table script for both projects.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.