summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-09-06 17:41:54 -0400
committerTim Graham <timograham@gmail.com>2016-09-22 13:07:23 -0400
commit0b59ea3343ef6f035064cfae1608f54c5a3fd147 (patch)
tree81a3499027dd1397d6345a518c4b4cba8e5a1cdd /docs/topics
parent190cd0e49f967d2ec0b6c50a63f0d58d13319611 (diff)
[1.10.x] Fixed #27186 -- Fixed model form default fallback for MultiWidget, FileInput, SplitDateTimeWidget, SelectDateWidget, and SplitArrayWidget.
Thanks Matt Westcott for the review. Backport of 3507d4e773aa9ff2336e7230ba231c4ba6eb568f from master
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/forms/modelforms.txt16
1 files changed, 11 insertions, 5 deletions
diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
index e2b57fe410..3d5bc746fe 100644
--- a/docs/topics/forms/modelforms.txt
+++ b/docs/topics/forms/modelforms.txt
@@ -299,6 +299,8 @@ to the ``error_messages`` dictionary of the ``ModelForm``’s inner ``Meta`` cla
}
}
+.. _topics-modelform-save:
+
The ``save()`` method
---------------------
@@ -333,11 +335,11 @@ 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 with
-``dont_use_model_field_default_for_empty_data=True``) 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 ``BooleanField``.
+:class:`~django.forms.CheckboxInput` (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`.
.. versionchanged:: 1.10.1
@@ -345,6 +347,10 @@ for a ``BooleanField``.
:class:`~django.forms.CheckboxInput` which means that unchecked checkboxes
receive a value of ``True`` if that's the model field default.
+.. versionchanged:: 1.10.2
+
+ The :meth:`~django.forms.Widget.value_omitted_from_data` method was added.
+
This ``save()`` method accepts an optional ``commit`` keyword argument, which
accepts either ``True`` or ``False``. If you call ``save()`` with
``commit=False``, then it will return an object that hasn't yet been saved to