Source code for werewolf.management.commands.syncww

__title__ = 'werewolf.management.commands.syncww'
__version__ = '0.4'
__build__ = 0x000004
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__all__ = ('Command',)

from django.core.management.base import BaseCommand
from django.db.models import get_models, get_app
from django.contrib.auth.management import create_permissions

[docs]class Command(BaseCommand): args = '<app app ...>' help = 'reloads permissions for specified apps, or all apps if no args are specified'
[docs] def handle(self, *args, **options): if not args: apps = [] for model in get_models(): apps.append(get_app(model._meta.app_label)) else: apps = [] for arg in args: apps.append(get_app(arg)) for app in apps: create_permissions(app, get_models(), options.get('verbosity', 0))
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.