I have a bunch of new permissions which I need to migrate. I tried doing it through data migration but complains about ContentType not being available
.
There are 2 ways to solve this:
1) The ugly way:
Run manage.py migrate auth
before your wanted migration
2) Recommended way:
from django.contrib.auth.management import create_permissions
def add_permissions(apps, schema_editor):
apps.models_module = True
create_permissions(apps, verbosity=0)
apps.models_module = None
# rest of code here....