Merge pull request #4551 from normanjaeckel/MotionReasonRequired

Fixed bug that motion reason is required if respective config value i…
This commit is contained in:
Emanuel Schütze 2019-04-02 11:08:44 +02:00 committed by GitHub
commit ff41aa8061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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."})