mel
mel

Reputation: 2790

Createsuperuser django.db.utils.IntegrityError: NOT NULL constraint failed

I have recently change my model which is a personified model adding fields. After having done so I remove the file:

'db.sqlite3'

And launch:

python manage.py migrate --run-syncdb

The user creation via my application is fine but when I want to create a super user

python manage.py createsuperuser

I get the following error:

django.db.utils.IntegrityError: NOT NULL constraint failed: website_dater.latitude

Upvotes: 2

Views: 2095

Answers (1)

Prakhar Trivedi
Prakhar Trivedi

Reputation: 8526

There is a field called latitude in your model named like website which is not taking any null entry. Either provide a value of latitude by default or use (null=True,blank=True) in defining that model, Like this :

class Website(models.Model):
    ....
    latitude = models.CharField(max_length=250, blank=True, null=True)

    # Or
    latitude = models.CharField(default='0')

Upvotes: 3

Related Questions