Update CTiT serializer integer field to handle html cornercase.

This commit is contained in:
Aaron Tan
2017-04-06 14:33:06 -04:00
parent 189ea4d7f8
commit b0a8e8c332

View File

@@ -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()