diff options
| author | Tom Christie | 2014-12-17 15:24:01 +0000 | 
|---|---|---|
| committer | Tom Christie | 2014-12-17 15:24:01 +0000 | 
| commit | ad6533e554663a4c6c40fb02c7d7341fb5afe47f (patch) | |
| tree | 107d0736824ab8000e26ea4e4be6ef13075d706b /rest_framework | |
| parent | ffc099a2561be259e6ca378886c0e969a2b5db94 (diff) | |
| parent | 3fff5cb6e0960b7ff8abd9f13a075f1f057de0a7 (diff) | |
| download | django-rest-framework-ad6533e554663a4c6c40fb02c7d7341fb5afe47f.tar.bz2 | |
Merge pull request #2294 from tomchristie/fix-empty-html-values-with-default
Fix empty HTML values when a default is provided.
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/fields.py | 5 | 
1 files changed, 5 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py index f3e17b18..5be2a21b 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -185,8 +185,13 @@ class Field(object):          self.allow_null = allow_null          if allow_null and self.default_empty_html is empty: +            # HTML input cannot represent `None` values, so we need to +            # forcibly coerce empty HTML values to `None` if `allow_null=True`.              self.default_empty_html = None +        if default is not empty: +            self.default_empty_html = default +          if validators is not None:              self.validators = validators[:]  | 
