Prevent conflicts in COF perm migration

There may be a conflict during the migration cof 0009 if the permissions
are referenced only by their codename.
This commit is contained in:
Martin Pépin 2017-02-22 18:21:23 +01:00
parent d36d69238d
commit c81b849785

View file

@ -30,8 +30,14 @@ def preserve_perms(apps, schema_editor):
apps.models_module = None
CofProfile = apps.get_model("cof", "CofProfile")
memberp = Permission.objects.get(codename='member')
burop = Permission.objects.get(codename='buro')
memberp = Permission.objects.get(
codename='member',
content_type__app_label="cof"
)
burop = Permission.objects.get(
codename='buro',
content_type__app_label="cof"
)
# creates the groups for COF members and
member = Group.objects.create(name='cof_members')