From 598a726394091fe6781b6f95c4f3c0e9e8972fcf Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 29 Nov 2018 16:13:31 +0100 Subject: [PATCH] Fixed user migrations --- openslides/users/migrations/0007_superadmin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openslides/users/migrations/0007_superadmin.py b/openslides/users/migrations/0007_superadmin.py index 57a83a168..ef2c69d5e 100644 --- a/openslides/users/migrations/0007_superadmin.py +++ b/openslides/users/migrations/0007_superadmin.py @@ -22,10 +22,18 @@ def create_superadmin_group(apps, schema_editor): return # Get the new superadmin group (or the old delegates) - superadmin, created_superadmin_group = Group.objects.get_or_create(pk=2, defaults={'name': '__temp__'}) + # we cannot use Group.objects.get_or_create here, because this would trigger an autoupdate + try: + superadmin = Group.objects.get(pk=2) + created_superadmin_group = False + except Group.DoesNotExist: + superadmin = Group(pk=2, name='__temp__') + superadmin.save(skip_autoupdate=True) + created_superadmin_group = True if not created_superadmin_group: - new_delegate = Group.objects.create(name='Delegates2') + new_delegate = Group(name='Delegates2') + new_delegate.save(skip_autoupdate=True) new_delegate.permissions.set(superadmin.permissions.all()) superadmin.permissions.set([])