Reputation: 891
Dumped data python manage.py dumpdata --format json --indent 4 --exclude auth.permission --exclude contenttypes > app/fixtures/app_test_data.json
Running python manage.py test app, I get the following error:
IntegrityError: Problem installing fixtures: The row in table 'django_admin_log' with primary key '517' has an invalid foreign key: django_admin_log.content_type_id contains a value '28' that does not have a corresponding value in django_content_type.id.
Any ideas? I've had a lot of similar issues using dumpdata/Django's test-runner.
Upvotes: 11
Views: 3201
Reputation: 21
If:
python manage.py dumpdata --exclude auth.permission --exclude contenttypes > db.json
You may recover the information trapped in the json with a text editor, opening the file and deleting the elements associate with the admin.logentry model.
That worked for me!
Upvotes: 2
Reputation: 14086
If you exclude the contenttype app as in your example, you may not be able to export any app that has foreginkeys against that app. Removing the --exclude contenttypes
might make it work.
Upvotes: 0