diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-01-29 17:41:48 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-07-01 18:02:28 +0200 |
commit | 49e87a9cb4e32c30e004dbf87f1b8f4d8326282f (patch) | |
tree | cd63cc6c0ed2e4d907c0026ea00682067064912b /ishtar_common/migrations/0044_add_import_group.py | |
parent | a3c9b4a707d80c6ba043c11703f8af46ccb6d16c (diff) | |
download | Ishtar-49e87a9cb4e32c30e004dbf87f1b8f4d8326282f.tar.bz2 Ishtar-49e87a9cb4e32c30e004dbf87f1b8f4d8326282f.zip |
Finish migration refactoring
Diffstat (limited to 'ishtar_common/migrations/0044_add_import_group.py')
-rw-r--r-- | ishtar_common/migrations/0044_add_import_group.py | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/ishtar_common/migrations/0044_add_import_group.py b/ishtar_common/migrations/0044_add_import_group.py deleted file mode 100644 index 8ff5117b4..000000000 --- a/ishtar_common/migrations/0044_add_import_group.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.10 on 2018-04-12 17:51 -from __future__ import unicode_literals - -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") - - 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( - txt_idx="administrator", - defaults={ - 'label':"Administrateur", 'comment': "", 'available':True - } - ) - - # add all existing groups to administrator - current_groups = list([g.pk for g in pt.groups.all()]) - for gp in Group.objects.all(): - if gp.pk not in current_groups: - pt.groups.add(gp) - - -class Migration(migrations.Migration): - - dependencies = [ - ('ishtar_common', '0043_remove_persontype_groups'), - ] - - operations = [ - migrations.RunPython(add_import_group), - ] |