Commit e88e3c6a by Yuri Prezument

Possible fix for #1330

Coerce None to '' in CharField.to_native()
parent 46f5c625
...@@ -452,7 +452,9 @@ class CharField(WritableField): ...@@ -452,7 +452,9 @@ class CharField(WritableField):
self.validators.append(validators.MaxLengthValidator(max_length)) self.validators.append(validators.MaxLengthValidator(max_length))
def from_native(self, value): def from_native(self, value):
if isinstance(value, six.string_types) or value is None: if value is None:
return ''
if isinstance(value, six.string_types):
return value return value
return smart_text(value) return smart_text(value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment