Migrating django admin auth.groups and users to a new database using fixtures

Viewed 4897

Here's the scenario:

I'm using django's admin interface and I would like to be able to load users and groups via fixtures (if this is possible.) I'm able to dump users/groups like so:

manage.py dumpdata auth auth.group > usersandgroups.json

But upon loading the data in a brand new database...

manage.py loaddata <appname>/fixtures/usersandgroups.json

I get all sorts of errors having to do with foreign keys and such. Here's an example of one:

django.db.utils.IntegrityError: insert or update on table "auth_permission" violates foreign key constraint "content_type_id_refs_id_728de91f"

DETAIL: Key (content_type_id)=(37) is not present in table "django_content_type".

I'd really appreciate it if anyone could point me in the right direction. Thanks in advance!

1 Answers
Related