Hi,
I've been trying to compare two passwords, but I always get the same
error. This was taken from the django test web page and I tried to run
it on my idle shell:
class UserRegistration(Form):
username = CharField(max_length=10)
password1 = CharField(widget=PasswordInput)
password2 = CharField(widget=PasswordInput)
def clean_password2(self):
if self.cleaned_data.get('password1') and
self.cleaned_data.get('password2') and self.cleaned_data['password1'] !
= self.cleaned_data['password2']:
raise ValidationError(u'Please make sure your passwords
match.')
return self.cleaned_data['password2']
data={'username':'ana',
'password1':'123',
'password2':'4232'}
f=UserRegistration(data)
f.clean()
Traceback (most recent call last):
File "<pyshell#190>", line 1, in <module>
f.clean()
File "/nobackup/reis/Python/lib/python2.5/site-packages/django/
newforms/forms.py", line 199, in clean
return self.clean_data
AttributeError: 'UserRegistration' object has no attribute
'clean_data'
This code was taken from the
http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L2447
so it should work... I get exactly the same error when I try to do
this on my web page... why is this happening?
Regards.
Ana
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---