Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a new form test that I forgot to commit in [5348]. Refs #3718.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5354 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 193a83ca509acfb3db4694809461a1476f6530bb 1 parent aae36cf
@malcolmt malcolmt authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/regressiontests/forms/tests.py
View
19 tests/regressiontests/forms/tests.py
@@ -3655,6 +3655,25 @@
u' class="news" title="Read this"'
>>> flatatt({})
u''
+
+####################################
+# Test accessing errors in clean() #
+####################################
+
+>>> class UserForm(Form):
+... username = CharField(max_length=10)
+... password = CharField(widget=PasswordInput)
+... def clean(self):
+... data = self.cleaned_data
+... if not self.errors:
+... data['username'] = data['username'].lower()
+... return data
+
+>>> f = UserForm({'username': 'SirRobin', 'password': 'blue'})
+>>> f.is_valid()
+True
+>>> f.cleaned_data['username']
+u'sirrobin'
"""
__test__ = {
Please sign in to comment.
Something went wrong with that request. Please try again.