On Jun 26, 12:30 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-06-26 at 04:57 -0700, AnaReis wrote:
> > 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'
>
> Your example is using "cleaned_data", but this traceback is using older
> Django code that is using "clean_data" as the attribute on the Form. So
> there's a mismatch in the versions of the code you are using somewhere.
>
> Regards,
> Malcolm
>
> --
> For every action there is an equal and opposite 
> criticism.http://www.pointy-stick.com/blog/

Hi,

I have the previous version, so I had to change it to clean_data:

def clean_retype_Password(self):
        if self.clean_data.get('password') and
self.clean_data.get('retype_Password') and
self.clean_data['password'] != self.clean_data['retype_Password']:
            raise ValidationError(u'Please make sure your passwords
match.')
        return self.clean_data['retype_Password']

Now it works perfectly...

I have a question, do you think I should get the newer version? I
would if I knew it was easy to update... Because I'm working on linux
and I'm not very used to work with this os and sometimes those path
things make me crazy, so what I mean is, is it worth all the trouble I
would have on installing django and fixing the path things and stuff
or is it ok if I continue using this version? (The version of Django
is 0.96)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to