I'm using userena and after adding the following line to my models.py
zipcode = models.IntegerField(_('zipcode'), max_length=5)
I get the following error after I hit the submit button on th signup form:
IntegrityError at /accounts/signup/ NOT NULL constraint failed: accounts_myprofile.zipcode
My question is what does this error mean, and is this related to Userena?
utils. IntegrityError: NOT NULL constraint failed. Go to the migrations folder and delete manually files that have 000*_lastAction_blah-blah type of name, you can delete, probably all, but 0001_initial.py file. After that run ./manage.py make migrations app_you_are_updateing, it should update your database.
By default, a column can hold NULL values. The NOT NULL constraint enforces a column to NOT accept NULL values. This enforces a field to always contain a value, which means that you cannot insert a new record, or update a record without adding a value to this field.
You must create a migration, where you will specify default value for a new field, since you don't want it to be null. If null is not required, simply add null=True
and create and run migration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With