diff options
| -rw-r--r-- | ishtar_common/management/commands/import_access_controls.py | 1 | ||||
| -rw-r--r-- | ishtar_common/migrations/0044_add_import_group.py | 11 | 
2 files changed, 10 insertions, 2 deletions
| diff --git a/ishtar_common/management/commands/import_access_controls.py b/ishtar_common/management/commands/import_access_controls.py index 62692485d..c13f41731 100644 --- a/ishtar_common/management/commands/import_access_controls.py +++ b/ishtar_common/management/commands/import_access_controls.py @@ -26,6 +26,7 @@ from django.contrib.contenttypes.models import ContentType  from ishtar_common.models import PersonType +  class Command(BaseCommand):      args = '<access control file>'      help = 'Import access controls' diff --git a/ishtar_common/migrations/0044_add_import_group.py b/ishtar_common/migrations/0044_add_import_group.py index bff5442ac..8ff5117b4 100644 --- a/ishtar_common/migrations/0044_add_import_group.py +++ b/ishtar_common/migrations/0044_add_import_group.py @@ -7,13 +7,20 @@ from django.db import migrations  def add_import_group(apps, schema_editor):      Group = apps.get_model('auth', 'Group') +    ContentType = apps.get_model('contenttypes', 'ContentType')      ProfileType = apps.get_model('ishtar_common', 'ProfileType')      Permission = apps.get_model('auth', 'Permission')      gp, created = Group.objects.get_or_create(          name="Import : ajout/modification/suppression") -    for perm in ['add_import', 'change_import', 'delete_import']: -        p = Permission.objects.get(codename=perm) +    content_type, created = ContentType.objects.get_or_create( +        model='import', app_label='ishtar_common') + +    for perm, name in (('add_import', "Can add Import"), +                       ('change_import', "Can change Import"), +                       ('delete_import', "Can delete Import")): +        p, created = Permission.objects.get_or_create( +            codename=perm, name=name, content_type=content_type)          gp.permissions.add(p)      pt, created = ProfileType.objects.get_or_create( | 
