diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-16 02:07:51 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-16 02:07:51 -0400 |
commit | d9efaa1fbdd6fb1fd9b81007ea702343d89a6163 (patch) | |
tree | 122766808aacdc8e5a6b2628853ef21c23ac7162 | |
parent | f86095bab5e5af6a2bf8be8ebe46d445864b4b71 (diff) | |
parent | b907a700616c4d96fbb7a801b624d1193fc53aec (diff) |
Merge branch 'archweb-generic'
-rw-r--r-- | devel/management/commands/update_types_permissions.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/devel/management/commands/update_types_permissions.py b/devel/management/commands/update_types_permissions.py index bbe8dc47..ac8fcfa5 100644 --- a/devel/management/commands/update_types_permissions.py +++ b/devel/management/commands/update_types_permissions.py @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand -from django.db.models import get_models, get_app +from django.apps import apps from django.contrib.auth.management import create_permissions from django.contrib.contenttypes.management import update_contenttypes @@ -10,16 +10,14 @@ class Command(BaseCommand): def handle(self, *args, **options): if not args: - apps = [] - for model in get_models(): - apps.append(get_app(model._meta.app_label)) + app_configs = apps.get_app_configs() else: - apps = [] + app_configs = [] for arg in args: - apps.append(get_app(arg)) + apps.append(apps.get_app_config(arg)) - for app in apps: - update_contenttypes(app, None, options.get('verbosity', 2), interactive=True) - create_permissions(app, get_models(), options.get('verbosity', 0)) + for app_config in app_configs: + update_contenttypes(app_config, options.get('verbosity', 2)) + create_permissions(app_config, options.get('verbosity', 22)) # vim: set ts=4 sw=4 et: |