Ticket #13100: 12833.diff
File 12833.diff, 1.8 KB (added by , 15 years ago) |
---|
-
docs/ref/models/instances.txt
34 34 35 35 .. versionadded:: 1.2 36 36 37 There are three steps in validating a model, and all three are called by a 38 model's ``full_clean()`` method. Most of the time, this method will be called 39 automatically by a ``ModelForm``. (See the :ref:`ModelForm documentation 40 <topics-forms-modelforms>` for more information.) You should only need to call 41 ``full_clean()`` if you plan to handle validation errors yourself. 37 There are three steps in validating a model: 42 38 39 * Validate the model fields 40 * Validate the model as a whole 41 * Validate the field uniqueness 42 43 All three steps are performed by a model's ``full_clean()`` method. 44 Most of the time, each step is performed automatically via the is_valid method of ``ModelForm``. (See the :ref:`ModelForm documentation <topics-forms-modelforms>` 45 for more information.) 46 You should only need to call a model's ``full_clean()`` method if you plan to 47 handle validation errors yourself. 48 43 49 .. method:: Model.full_clean(exclude=None) 44 50 45 51 This method calls ``Model.clean_fields()``, ``Model.clean()``, and … … 52 58 validated since any errors raised could not be corrected by the user. 53 59 54 60 Note that ``full_clean()`` will NOT be called automatically when you call 55 your model's ``save()`` method. You'll need to call it manually if you want 56 to run model validation outside of a ``ModelForm``. (This is for backwards 57 compatibility.) 61 your model's ``save()`` method, nor through ``ModelForm`` validation. 62 You'll need to call it manually when you want to run model validation outside of a ``ModelForm``. (This is for backwards compatibility.) 58 63 59 64 Example:: 60 65