Field 'id' doesn't have a default value django-registration
-
22-12-2019 - |
Question
I recently loaded all of the django-registration tables from sqlite into a mysql database. 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.
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.
La solution
You probably have incorrect table structure. Try to:
- Create test project and setup connection to test blank database.
- Then try to do
manage.py syncdb
on test project. - Compare table
auth_user
structure between current and test project. For example compare create table script for both projects.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow