diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index f2136b2..8a53037 100644
a
|
b
|
from a view.
|
173 | 173 | |
174 | 174 | The ``field`` argument is the name of the field to which the errors |
175 | 175 | should be added. If its value is ``None`` the error will be treated as |
176 | | a non-field error as returned by ``Form.non_field_errors()``. |
| 176 | a non-field error as returned by :meth:`Form.non_field_errors() |
| 177 | <django.forms.Form.non_field_errors>`. |
177 | 178 | |
178 | 179 | The ``error`` argument can be a simple string, or preferably an instance of |
179 | 180 | ``ValidationError``. See :ref:`raising-validation-error` for best practices |
… |
… |
if the field contains any errors at all.
|
193 | 194 | To check for non-field errors use |
194 | 195 | :data:`~django.core.exceptions.NON_FIELD_ERRORS` as the ``field`` parameter. |
195 | 196 | |
| 197 | .. method:: Form.non_field_errors() |
| 198 | |
| 199 | This method returns the list of errors from :attr:`Form.errors |
| 200 | <django.forms.Form.errors>` that aren't associated with a particular field. |
| 201 | This includes ``ValidationError``\s that are raised in :meth:`Form.clean() |
| 202 | <django.forms.Form.clean>` and errors added using :meth:`Form.add_error(None, |
| 203 | "...") <django.forms.Form.add_error>`. |
| 204 | |
196 | 205 | Behavior of unbound forms |
197 | 206 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
198 | 207 | |
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index 13c1e5a..63fc6f2 100644
a
|
b
|
overridden:
|
85 | 85 | Note that any errors raised by your ``Form.clean()`` override will not |
86 | 86 | be associated with any field in particular. They go into a special |
87 | 87 | "field" (called ``__all__``), which you can access via the |
88 | | ``non_field_errors()`` method if you need to. If you want to attach |
89 | | errors to a specific field in the form, you need to call |
| 88 | :meth:`~django.forms.Form.non_field_errors` method if you need to. If you |
| 89 | want to attach errors to a specific field in the form, you need to call |
90 | 90 | :meth:`~django.forms.Form.add_error()`. |
91 | 91 | |
92 | 92 | Also note that there are special considerations when overriding |
… |
… |
form's ``clean()`` method, in which case you can use
|
329 | 329 | :meth:`~django.forms.Form.add_error()`. Note that this won't always be |
330 | 330 | appropriate and the more typical situation is to raise a ``ValidationError`` |
331 | 331 | from , which is turned into a form-wide error that is available through the |
332 | | ``Form.non_field_errors()`` method. |
| 332 | :meth:`Form.non_field_errors() <django.forms.Form.non_field_errors>` method. |
333 | 333 | |
334 | 334 | Cleaning and validating fields that depend on each other |
335 | 335 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index f56cbee..30eec42 100644
a
|
b
|
your test suite.
|
1269 | 1269 | |
1270 | 1270 | ``field`` is the name of the field on the form to check. If ``field`` |
1271 | 1271 | has a value of ``None``, non-field errors (errors you can access via |
1272 | | ``form.non_field_errors()``) will be checked. |
| 1272 | :meth:`form.non_field_errors() <django.forms.Form.non_field_errors>`) will |
| 1273 | be checked. |
1273 | 1274 | |
1274 | 1275 | ``errors`` is an error string, or a list of error strings, that are |
1275 | 1276 | expected as a result of form validation. |
… |
… |
your test suite.
|
1288 | 1289 | |
1289 | 1290 | ``field`` is the name of the field on the form to check. If ``field`` |
1290 | 1291 | has a value of ``None``, non-field errors (errors you can access via |
1291 | | ``form.non_field_errors()``) will be checked. |
| 1292 | :meth:`form.non_field_errors() <django.forms.Form.non_field_errors>`) will |
| 1293 | be checked. |
1292 | 1294 | |
1293 | 1295 | ``errors`` is an error string, or a list of error strings, that are |
1294 | 1296 | expected as a result of form validation. |