From 19df7c82a252be7633342c4e1051303bc0816bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 19 Nov 2015 19:56:01 +0100 Subject: [PATCH] Enabled possibility to send null for motion poll votes vote value fields. --- openslides/motions/serializers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index 762e81420..38d1bc44a 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -98,7 +98,7 @@ class MotionPollSerializer(ModelSerializer): no = SerializerMethodField() abstain = SerializerMethodField() votes = DictField( - child=IntegerField(min_value=-2), + child=IntegerField(min_value=-2, allow_null=True), write_only=True) class Meta: @@ -117,7 +117,7 @@ class MotionPollSerializer(ModelSerializer): def to_representation(self, obj): """ Overrides the output of this serializer. Replaces vote values -1 - through the translated string 'majority' and -2 or None through the + through the translated string 'majority' and -2 through the translated string 'undocumented'. """ result = super().to_representation(obj) @@ -125,7 +125,7 @@ class MotionPollSerializer(ModelSerializer): if key in ('yes', 'no', 'abstain', 'votesvalid', 'votesinvalid', 'votescast'): if result[key] == -1: result[key] = _('majority') - elif result[key] == -2 or result[key] is None: + elif result[key] == -2: result[key] = _('undocumented') return result