[Django]-Django loaddata returns a permission denied for relation

4👍

The postgres user for this db was created automatically and I did not check the permissions, they were missing for this db so a GRANT ALL PRIVILEGES ON DATABASE x for user y; resolved the permissions problem. My bad.

2👍

Looks like you’re exporting ContentType objects (did you dumpdata with --all?), is this by design?

The docs mention that you might want to use the --natural flag, that fixes problems such as this, see https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-option—natural

Also see this quote:

If you’re serializing data (for example, when generating fixtures) from a model that implements generic relations, you should probably be using a natural key to uniquely identify related ContentType objects. See natural keys and dumpdata –natural for more information.

Source: https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/

Leave a comment