From 861dc1c02e14428aad3369221c75963cf6a6c808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 30 Mar 2019 11:08:35 +0100 Subject: [PATCH] Fixed bug that motion reason is required if respective config value is set. --- openslides/motions/serializers.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index 3616c4dd8..cb52981fb 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -472,10 +472,9 @@ class MotionSerializer(ModelSerializer): else: if "text" in data and not data["text"]: raise ValidationError({"detail": "The text field may not be blank."}) - if ( - "reason" in data - and not data["reason"] - and config["motions_reason_required"] + if config["motions_reason_required"]: + if (self.partial and "reason" in data and not data["reason"]) or ( + not self.partial and not data.get("reason") ): raise ValidationError({"detail": "The reason field may not be blank."})