Reputation: 1
Django saves the data but eventually raises an IntegrityError. If there is an error, why it is saving that data? And I'm sure that the uniqueness property is not violated on that data.
What is going on? Why is that error occurs? and how can I solve that?
Upvotes: 0
Views: 246
Reputation: 8449
I had the same problem. Using Django 1.3.1 and Sqlite3, I had changed the field properties setting blank=True and null=True, but still got the IntegrityError: "Field may not be null". I tried successive python manage.py syncdb
and python manage.py sqlflush
with no luck.
I solved it creating a new DB (that is, changing the path to a non-existent filename), and then everything was perfect. Obviously, existing data migration is an issue.
Upvotes: 0
Reputation: 917
Most likely your model has a field which doesn't allow null value and you are trying to add object without any value for that field.
If you can Edit your post and add more details (like model & traceback) then you can expect better response.
Upvotes: 1