1 | Index: docs/ref/models/instances.txt |
---|
2 | =================================================================== |
---|
3 | --- docs/ref/models/instances.txt (revision 12833) |
---|
4 | +++ docs/ref/models/instances.txt (working copy) |
---|
5 | @@ -34,12 +34,18 @@ |
---|
6 | |
---|
7 | .. versionadded:: 1.2 |
---|
8 | |
---|
9 | -There are three steps in validating a model, and all three are called by a |
---|
10 | -model's ``full_clean()`` method. Most of the time, this method will be called |
---|
11 | -automatically by a ``ModelForm``. (See the :ref:`ModelForm documentation |
---|
12 | -<topics-forms-modelforms>` for more information.) You should only need to call |
---|
13 | -``full_clean()`` if you plan to handle validation errors yourself. |
---|
14 | +There are three steps in validating a model: |
---|
15 | |
---|
16 | + * Validate the model fields |
---|
17 | + * Validate the model as a whole |
---|
18 | + * Validate the field uniqueness |
---|
19 | + |
---|
20 | +All three steps are performed by a model's ``full_clean()`` method. |
---|
21 | +Most of the time, each step is performed automatically via the is_valid method of ``ModelForm``. (See the :ref:`ModelForm documentation <topics-forms-modelforms>` |
---|
22 | +for more information.) |
---|
23 | +You should only need to call a model's ``full_clean()`` method if you plan to |
---|
24 | +handle validation errors yourself. |
---|
25 | + |
---|
26 | .. method:: Model.full_clean(exclude=None) |
---|
27 | |
---|
28 | This method calls ``Model.clean_fields()``, ``Model.clean()``, and |
---|
29 | @@ -52,9 +58,8 @@ |
---|
30 | validated since any errors raised could not be corrected by the user. |
---|
31 | |
---|
32 | Note that ``full_clean()`` will NOT be called automatically when you call |
---|
33 | -your model's ``save()`` method. You'll need to call it manually if you want |
---|
34 | -to run model validation outside of a ``ModelForm``. (This is for backwards |
---|
35 | -compatibility.) |
---|
36 | +your model's ``save()`` method, nor through ``ModelForm`` validation. |
---|
37 | +You'll need to call it manually when you want to run model validation outside of a ``ModelForm``. (This is for backwards compatibility.) |
---|
38 | |
---|
39 | Example:: |
---|
40 | |
---|