From e5e337f99a86166163dcc30bf7e6392221fe34f5 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 20 Jan 2018 15:23:42 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20probl=C3=A8mes=20sur=20les=20migrations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/migrations/0067_serveurpermission.py | 2 +- users/migrations/0068_auto_20180107_2245.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/users/migrations/0067_serveurpermission.py b/users/migrations/0067_serveurpermission.py index de4c3976..a5ea8387 100644 --- a/users/migrations/0067_serveurpermission.py +++ b/users/migrations/0067_serveurpermission.py @@ -23,7 +23,7 @@ class Migration(migrations.Migration): perm = permissions.objects.using(db_alias).create( codename='serveur', name='Serveur', - content_type=contenttype.objects.using(db_alias).filter(model='machine').first() + content_type=contenttype.objects.get_for_model(machine) ) group_object = rights.objects.using(db_alias).filter(unix_name='serveur').first() if not group_object: diff --git a/users/migrations/0068_auto_20180107_2245.py b/users/migrations/0068_auto_20180107_2245.py index 3ce232dc..27c4f446 100644 --- a/users/migrations/0068_auto_20180107_2245.py +++ b/users/migrations/0068_auto_20180107_2245.py @@ -17,8 +17,9 @@ class Migration(migrations.Migration): rights = apps.get_model("users", "ListRight") for right in critical_rights: rg = rights.objects.using(db_alias).filter(unix_name=right).first() - rg.critical=True - rg.save() + if rg: + rg.critical=True + rg.save() def untransfer_permissions(apps, schema_editor): return