From b0a8e8c3326b12176e5804e0c2ea1c3c4c0c7a32 Mon Sep 17 00:00:00 2001 From: Aaron Tan Date: Thu, 6 Apr 2017 14:33:06 -0400 Subject: [PATCH] Update CTiT serializer integer field to handle html cornercase. --- awx/conf/fields.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/awx/conf/fields.py b/awx/conf/fields.py index f8d012a3aa..e68523271b 100644 --- a/awx/conf/fields.py +++ b/awx/conf/fields.py @@ -31,6 +31,16 @@ class CharField(CharField): return super(CharField, self).to_representation(value) +class IntegerField(IntegerField): + + def get_value(self, dictionary): + ret = super(IntegerField, self).get_value(dictionary) + # Handle UI corner case + if ret == '' and self.allow_null and not getattr(self, 'allow_blank', False): + return None + return ret + + class StringListField(ListField): child = CharField()