[Django]-Allow null in foreign key to user. Django

34👍

club_vacancy.user_id may not be NULL

Looks very much like an error from your database, rather than from Django.

It seems most likely that you added null=True after running manage.py syncdb. You’ll need to modify your database schema to allow null values in that column.

3👍

Aside from South, another option is to use django evolution for schema changes.

http://code.google.com/p/django-evolution/

Install it before making db changes. Then run

python manage.py evolve --hint --execute

Make sure that if you add a new field, you allow nulls (null=True) or else evolve will give you an error message.

-5👍

you need to reset you database table (since just syncdb does not update fields that are alredy created with null=False)

./manage.py reset your_app

OR if there is some data that you do not want to loose use SQL commands to remove NOT NULL flag

Leave a comment