mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #4136 -- Made ModelForm save empty values for nullable CharFields as NULL.
Previously, empty values were saved as strings.
This commit is contained in:
parent
f2c0eb19e9
commit
267dc4addd
9 changed files with 66 additions and 18 deletions
|
@ -361,7 +361,7 @@ For each field, we describe the default widget used if you don't specify
|
|||
.. class:: CharField(**kwargs)
|
||||
|
||||
* Default widget: :class:`TextInput`
|
||||
* Empty value: ``''`` (an empty string)
|
||||
* Empty value: Whatever you've given as :attr:`empty_value`.
|
||||
* Normalizes to: A Unicode object.
|
||||
* Validates ``max_length`` or ``min_length``, if they are provided.
|
||||
Otherwise, all inputs are valid.
|
||||
|
@ -380,6 +380,12 @@ For each field, we describe the default widget used if you don't specify
|
|||
If ``True`` (default), the value will be stripped of leading and
|
||||
trailing whitespace.
|
||||
|
||||
.. attribute:: empty_value
|
||||
|
||||
.. versionadded:: 1.11
|
||||
|
||||
The value to use to represent "empty". Defaults to an empty string.
|
||||
|
||||
``ChoiceField``
|
||||
---------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue