summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-11-27 04:49:26 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-11-27 04:49:26 +0000
commit49236b95e904dbf8560cfb64eb4f5c430ec8f30a (patch)
treef72d7912194c788f72b1737d6446e828458e2707 /django
parent6d36d97cb8d0c982d7481e7d439c9848ded46a77 (diff)
newforms: Added Form.non_field_errors() and added more examples/documentation to the unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/newforms/forms.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py
index a07df84e54..667ae0a472 100644
--- a/django/newforms/forms.py
+++ b/django/newforms/forms.py
@@ -99,6 +99,13 @@ class Form(object):
output.append(line)
return u'\n'.join(output)
+ def non_field_errors(self):
+ """
+ Returns a list of errors that aren't associated with a particular
+ field -- i.e., from Form.clean().
+ """
+ return self.errors.get(NON_FIELD_ERRORS, [])
+
def full_clean(self):
"""
Cleans all of self.data and populates self.__errors and self.clean_data.
@@ -129,7 +136,9 @@ class Form(object):
def clean(self):
"""
Hook for doing any extra form-wide cleaning after Field.clean() been
- called on every field.
+ called on every field. Any ValidationError raised by this method will
+ not be associated with a particular field; it will have a special-case
+ association with the field named '__all__'.
"""
return self.clean_data