diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index f8ec205..f9f913b 100644
|
a
|
b
|
class Field(object):
|
| 57 | 57 | # Designates whether empty strings fundamentally are allowed at the |
| 58 | 58 | # database level. |
| 59 | 59 | empty_strings_allowed = True |
| | 60 | empty_values = list(validators.EMPTY_VALUES) |
| 60 | 61 | |
| 61 | 62 | # These track each time a Field instance is created. Used to retain order. |
| 62 | 63 | # The auto_creation_counter is used for fields that Django implicitly |
| … |
… |
class Field(object):
|
| 157 | 158 | return value |
| 158 | 159 | |
| 159 | 160 | def run_validators(self, value): |
| 160 | | if value in validators.EMPTY_VALUES: |
| | 161 | if value in self.empty_values: |
| 161 | 162 | return |
| 162 | 163 | |
| 163 | 164 | errors = [] |
| … |
… |
class Field(object):
|
| 184 | 185 | # Skip validation for non-editable fields. |
| 185 | 186 | return |
| 186 | 187 | |
| 187 | | if self._choices and value not in validators.EMPTY_VALUES: |
| | 188 | if self._choices and value not in self.empty_values: |
| 188 | 189 | for option_key, option_value in self.choices: |
| 189 | 190 | if isinstance(option_value, (list, tuple)): |
| 190 | 191 | # This is an optgroup, so look inside the group for |
| … |
… |
class Field(object):
|
| 200 | 201 | if value is None and not self.null: |
| 201 | 202 | raise exceptions.ValidationError(self.error_messages['null']) |
| 202 | 203 | |
| 203 | | if not self.blank and value in validators.EMPTY_VALUES: |
| | 204 | if not self.blank and value in self.empty_values: |
| 204 | 205 | raise exceptions.ValidationError(self.error_messages['blank']) |
| 205 | 206 | |
| 206 | 207 | def clean(self, value, model_instance): |
| … |
… |
class URLField(CharField):
|
| 1295 | 1296 | |
| 1296 | 1297 | class BinaryField(Field): |
| 1297 | 1298 | description = _("Raw binary data") |
| | 1299 | empty_values = [None, b''] |
| 1298 | 1300 | |
| 1299 | 1301 | def __init__(self, *args, **kwargs): |
| 1300 | 1302 | kwargs['editable'] = False |