Ticket #14885: trac#14885-is_valid.diff

File trac#14885-is_valid.diff, 1.1 KB (added by stumbles, 12 years ago)

Explain that is_valid() changes the model instance in place.

  • docs/topics/forms/modelforms.txt

    diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
    index 0ca3774..4e1e826 100644
    a b The ``is_valid()`` method and ``errors``  
    196196----------------------------------------
    197197
    198198The first time you call ``is_valid()`` or access the ``errors`` attribute of a
    199 ``ModelForm`` triggers :ref:`form validation <form-and-field-validation>` as
    200 well as :ref:`model validation <validating-objects>`. This has the side-effect
    201 of cleaning the model you pass to the ``ModelForm`` constructor. For instance,
    202 calling ``is_valid()`` on your form will convert any date fields on your model
    203 to actual date objects.
    204 
     199``ModelForm``, :ref:`form validation <form-and-field-validation>` and
     200:ref:`model validation <validating-objects>` are triggered. This process
     201updates the form's model instance in place. If the form validation fails, only
     202some of the updates may be applied. For this reason, you'll probably want to
     203avoid reusing the model instance.
    205204
    206205The ``save()`` method
    207206---------------------
Back to Top