IntegrityError at /***/ (1048, "Column '***' cannot be null") in python django

django, python

Solution

Try to

`user = models.OneToOneField(User, null=True, blank=True)`

And then recreate your db. You can find more on https://docs.djangoproject.com/en/1.4/ref/models/fields/#null

Else you can use Proxy models:

class UserExtraInfo(User):
#here your extra fields

In this case you won`t need to create UserExtraInfo instance in same time with User. Read more on https://docs.djangoproject.com/en/1.4/topics/db/models/#model-inheritance

Problem

Hi I am getting this error because I have a field in my additional user info model (`user = models.OneToOneField(User)`) that I am not filling in at sign up (as I want to let the user do it later). I wondered if there was any way to solve this problem other than allowing null field in the db? Cheers

Original source