|
@@ -40,7 +40,7 @@ class ChoiceField(serializers.Field):
|
|
|
return super().validate_empty_values(data)
|
|
return super().validate_empty_values(data)
|
|
|
|
|
|
|
|
def to_representation(self, obj):
|
|
def to_representation(self, obj):
|
|
|
- if obj is '':
|
|
|
|
|
|
|
+ if obj == '':
|
|
|
return None
|
|
return None
|
|
|
return OrderedDict([
|
|
return OrderedDict([
|
|
|
('value', obj),
|
|
('value', obj),
|
|
@@ -48,7 +48,7 @@ class ChoiceField(serializers.Field):
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
def to_internal_value(self, data):
|
|
def to_internal_value(self, data):
|
|
|
- if data is '':
|
|
|
|
|
|
|
+ if data == '':
|
|
|
if self.allow_blank:
|
|
if self.allow_blank:
|
|
|
return data
|
|
return data
|
|
|
raise ValidationError("This field may not be blank.")
|
|
raise ValidationError("This field may not be blank.")
|