Skip to content

Commit 6794b33

Browse files
committed
Fixes for defaulting empty HTML fields to '', None, or empty.
1 parent 7d417fc commit 6794b33

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rest_framework/fields.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ def __init__(self, read_only=False, write_only=False,
181181
self.style = {} if style is None else style
182182
self.allow_null = allow_null
183183

184+
if allow_null and self.default_empty_html is empty:
185+
self.default_empty_html = None
186+
184187
if validators is not None:
185188
self.validators = validators[:]
186189

@@ -495,6 +498,7 @@ class CharField(Field):
495498
}
496499
initial = ''
497500
coerce_blank_to_null = False
501+
default_empty_html = ''
498502

499503
def __init__(self, **kwargs):
500504
self.allow_blank = kwargs.pop('allow_blank', False)

0 commit comments

Comments
 (0)