mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Fixes for defaulting empty HTML fields to '', None, or empty.
This commit is contained in:
parent
7d417fc678
commit
6794b3380a
|
@ -181,6 +181,9 @@ class Field(object):
|
||||||
self.style = {} if style is None else style
|
self.style = {} if style is None else style
|
||||||
self.allow_null = allow_null
|
self.allow_null = allow_null
|
||||||
|
|
||||||
|
if allow_null and self.default_empty_html is empty:
|
||||||
|
self.default_empty_html = None
|
||||||
|
|
||||||
if validators is not None:
|
if validators is not None:
|
||||||
self.validators = validators[:]
|
self.validators = validators[:]
|
||||||
|
|
||||||
|
@ -495,6 +498,7 @@ class CharField(Field):
|
||||||
}
|
}
|
||||||
initial = ''
|
initial = ''
|
||||||
coerce_blank_to_null = False
|
coerce_blank_to_null = False
|
||||||
|
default_empty_html = ''
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.allow_blank = kwargs.pop('allow_blank', False)
|
self.allow_blank = kwargs.pop('allow_blank', False)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user