Reputation: 21018
I have a little project I am working. I am writing django database to hold some data. I have one ManyToManyField.
I am using my own Manager and adding methods for convience. I have one that adds different tasks to the users to do list. These items can be assigned to many people and so on.
When I do this I am getting an IntegrityError
What is the main cause of this? The exact error I am getting is.
...items_id may not be NULL
I would appreciate answer on how to fix this. Also an explanation on how this exception is thrown. I have been told to catch it. But I dont like things being thrown unless they need to be.
Please and thank you!
Upvotes: 2
Views: 2501
Reputation: 21018
Turns out all I needed to do was clean out my database with a python manage.py sqlflush
Everything was fine afterwards. I then added south to help with migrations in the future.
I would advise caution since sqlflush
will return your database to back the state of the last syncdb.
Upvotes: 3