diff options
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 9d707c9b..8e15345d 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -475,8 +475,12 @@ class CharField(WritableField):          if isinstance(value, six.string_types):              return value -        if value is None and not self.allow_none: -            return '' +        if value is None: +            if not self.allow_none: +                return '' +            else: +                # Return None explicitly because smart_text(None) == 'None'. See #1834 for details +                return None          return smart_text(value) | 
