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
This commit is contained in:
Malcolm Tredinnick 2007-05-26 09:47:47 +00:00
parent aae36cfc8e
commit 193a83ca50
1 changed files with 19 additions and 0 deletions

View File

@ -3655,6 +3655,25 @@ u' id="header"'
u' class="news" title="Read this"' u' class="news" title="Read this"'
>>> flatatt({}) >>> flatatt({})
u'' 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__ = { __test__ = {