From 185055d604192f9417a4ec6cff52793517d7c8ac Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Wed, 16 May 2018 13:03:37 +0200 Subject: [PATCH] Autoupdate with affected users on group delete (fixes #3455) --- openslides/users/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openslides/users/views.py b/openslides/users/views.py index 36db3dc35..6a20e1ce0 100644 --- a/openslides/users/views.py +++ b/openslides/users/views.py @@ -333,7 +333,15 @@ class GroupViewSet(ModelViewSet): instance = self.get_object() if instance.pk == 1: self.permission_denied(request) + # The list() is required to evaluate the query + affected_users_ids = list(instance.user_set.values_list('pk', flat=True)) + + # Delete the group self.perform_destroy(instance) + + # Get the updated user data from the DB. + affected_users = User.objects.filter(pk__in=affected_users_ids) + inform_changed_data(affected_users) return Response(status=status.HTTP_204_NO_CONTENT)