From 28059698c7c85675f1c3a1bfb74c418af70ef94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 19 Nov 2016 13:04:24 +0100 Subject: [PATCH] Fixed projector broadcast if projector is deleted. Fixed #2646. --- openslides/core/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openslides/core/views.py b/openslides/core/views.py index 859ebb4c8..aa398e718 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -204,13 +204,20 @@ class ProjectorViewSet(ModelViewSet): result = False return result - # Assign all ProjectionDefault objects from this projector to the default projector (pk=1). def destroy(self, *args, **kwargs): + """ + REST API operation for DELETE requests. + + Assigns all ProjectionDefault objects from this projector to the + default projector (pk=1). Resets broadcast if set to this projector. + """ projector_instance = self.get_object() for projection_default in ProjectionDefault.objects.all(): if projection_default.projector.id == projector_instance.id: projection_default.projector_id = 1 projection_default.save() + if config['projector_broadcast'] == projector_instance.pk: + config['projector_broadcast'] = 0 return super(ProjectorViewSet, self).destroy(*args, **kwargs) @detail_route(methods=['post'])