diff options
| author | heathervm <heathervmurray@gmail.com> | 2017-03-31 07:10:08 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-03-31 10:17:17 -0400 |
| commit | 83331d1ed0fde144767e8f35f2d9e512bdd2afb1 (patch) | |
| tree | 400dbb53116741c0338c547fe6313c2bc334723f /docs | |
| parent | ab38f4b27b11c3fcd6d8fd47415708df9309b8e2 (diff) | |
[1.10.x] Fixed #27993 -- Fixed model form default fallback for SelectMultiple.
Backport of 7d1e23775344cc3dead03bd4af45f4fdf134b819 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/forms/widgets.txt | 11 | ||||
| -rw-r--r-- | docs/releases/1.10.7.txt | 3 | ||||
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 12 |
3 files changed, 16 insertions, 10 deletions
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index b977513bad..71bebf26ef 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -281,11 +281,12 @@ foundation for custom widgets. The method's result affects whether or not a field in a model form :ref:`falls back to its default <topics-modelform-save>`. - Special cases are :class:`~django.forms.CheckboxInput` and - :class:`~django.forms.CheckboxSelectMultiple`, which always return - ``False`` because an unchecked checkbox doesn't appear in the data of - an HTML form submission, so it's unknown whether or not the user - actually submitted a value. + Special cases are :class:`~django.forms.CheckboxInput`, + :class:`~django.forms.CheckboxSelectMultiple`, and + :class:`~django.forms.SelectMultiple`, which always return + ``False`` because an unchecked checkbox and unselected + ``<select multiple>`` don't appear in the data of an HTML form + submission, so it's unknown whether or not the user submitted a value. .. method:: use_required_attribute(initial) diff --git a/docs/releases/1.10.7.txt b/docs/releases/1.10.7.txt index de9a511f07..9d4f79f5bf 100644 --- a/docs/releases/1.10.7.txt +++ b/docs/releases/1.10.7.txt @@ -11,3 +11,6 @@ Bugfixes * Made admin's ``RelatedFieldWidgetWrapper`` use the wrapped widget's ``value_omitted_from_data()`` method (:ticket:`27905`). + +* Fixed model form ``default`` fallback for ``SelectMultiple`` + (:ticket:`27993`). diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 768dc3938c..8f9828641a 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -335,12 +335,14 @@ doesn't validate -- i.e., if ``form.errors`` evaluates to ``True``. If an optional field doesn't appear in the form's data, the resulting model instance uses the model field :attr:`~django.db.models.Field.default`, if there is one, for that field. This behavior doesn't apply to fields that use -:class:`~django.forms.CheckboxInput` and -:class:`~django.forms.CheckboxSelectMultiple` (or any custom widget whose +:class:`~django.forms.CheckboxInput`, +:class:`~django.forms.CheckboxSelectMultiple`, or +:class:`~django.forms.SelectMultiple` (or any custom widget whose :meth:`~django.forms.Widget.value_omitted_from_data` method always returns -``False``) since an unchecked checkbox doesn't appear in the data of an HTML -form submission. Use a custom form field or widget if you're designing an API -and want the default fallback for a :class:`~django.db.models.BooleanField`. +``False``) since an unchecked checkbox and unselected ``<select multiple>`` +don't appear in the data of an HTML form submission. Use a custom form field or +widget if you're designing an API and want the default fallback behavior for a +field that uses one of these widgets. .. versionchanged:: 1.10.1 |
