Last active
January 10, 2022 01:33
-
-
Save drinks/5447540 to your computer and use it in GitHub Desktop.
Regenerate permissions when they get out of sync with content types in a django project (will destroy all existing permissions) I swear there used to be a management command for this...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import get_apps, get_models | |
from django.contrib.auth.management import create_permissions | |
Permission.objects.all().delete() | |
[create_permissions(app, get_models(app), 2) for app in get_apps()] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe the management command you are referring to is part of django_extensions