aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorTom Christie2014-12-17 16:19:13 +0000
committerTom Christie2014-12-17 16:19:13 +0000
commit265ed9377e457ec6b757ff07e0720b0ebefbb89d (patch)
tree226aaac38a8651c4cf1710cd1dbb9b0e91697f57 /rest_framework/fields.py
parentc9a2ce07037475359712104a8a68624e99bdfeb1 (diff)
parentad6533e554663a4c6c40fb02c7d7341fb5afe47f (diff)
downloaddjango-rest-framework-265ed9377e457ec6b757ff07e0720b0ebefbb89d.tar.bz2
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py5
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[:]