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:
parent
aae36cfc8e
commit
193a83ca50
|
@ -3655,6 +3655,25 @@ u' id="header"'
|
|||
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__ = {
|
||||
|
|
Loading…
Reference in New Issue