[Django]-IntegrityError when loading fixture during django testing

50👍

Apparently one of the traps for the unwary is that one must exclude contenttypes when exporting fixtures. (Thanks to subsume on #django for the information).

To exclude content types use the -e option when running the dumpdata command.

$./manage.py dumpdata -e contenttypes > initial_data.json
👤Marcin

11👍

python manage.py dumpdata --exclude=contenttypes --exclude=auth.Permission > initial_data.json

Leave a comment