@@ -192,6 +192,8 @@ we'll discuss in a moment.)::
192192 name = forms.CharField(max_length=100)
193193 authors = forms.ModelMultipleChoiceField(queryset=Author.objects.all())
194194
195+ .. _modelform-is-valid-and-errors:
196+
195197The ``is_valid()`` method and ``errors``
196198----------------------------------------
197199
@@ -213,7 +215,9 @@ method. This method creates and saves a database object from the data
213215bound to the form. A subclass of ``ModelForm`` can accept an existing
214216model instance as the keyword argument ``instance``; if this is
215217supplied, ``save()`` will update that instance. If it's not supplied,
216- ``save()`` will create a new instance of the specified model::
218+ ``save()`` will create a new instance of the specified model:
219+
220+ .. code-block:: python
217221
218222 # Create a form instance from POST data.
219223 >>> f = ArticleForm(request.POST)
@@ -232,8 +236,10 @@ supplied, ``save()`` will update that instance. If it's not supplied,
232236 >>> f = ArticleForm(request.POST, instance=a)
233237 >>> f.save()
234238
235- Note that ``save()`` will raise a ``ValueError`` if the data in the form
236- doesn't validate -- i.e., if form.errors evaluates to True.
239+ Note that if the form :ref:`hasn't been validated
240+ <modelform-is-valid-and-errors>`, calling ``save()`` will do so by checking
241+ ``form.errors``. A ``ValueError`` will be raised if the data in the form
242+ doesn't validate -- i.e., if ``form.errors`` evaluates to ``True``.
237243
238244This ``save()`` method accepts an optional ``commit`` keyword argument, which
239245accepts either ``True`` or ``False``. If you call ``save()`` with
0 commit comments