سؤال

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.

هل كانت مفيدة؟

المحلول

You probably have incorrect table structure. Try to:

  1. Create test project and setup connection to test blank database.
  2. Then try to do manage.py syncdb on test project.
  3. Compare table auth_user structure between current and test project. For example compare create table script for both projects.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top