1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.10.x] Refs #27186 -- Fixed model form default fallback for CheckboxSelectMultiple.

Backport of 87c5e7efeb from master
This commit is contained in:
Tim Graham
2016-09-30 14:49:50 -04:00
parent fb9f396275
commit f23c03ebc8
6 changed files with 38 additions and 10 deletions

View File

@@ -335,7 +335,8 @@ 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` (or any custom widget whose
:class:`~django.forms.CheckboxInput` and
:class:`~django.forms.CheckboxSelectMultiple` (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