Here's an example from the documentation for newforms. < http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L2204 >
On 2/11/07, lee <[EMAIL PROTECTED]> wrote: > > > > 2007/2/11, Honza Král <[EMAIL PROTECTED]>: > > > > > > you can just add a clean_password method to your Form class that would > > compare the two fields values and raise a ValidationError if they > > don't match > > > Thank you for your reply ,but I can't very understand your meaning , this > is what I write : > > > class RegBasicForm(forms.Form): > user = forms.CharField(max_length=16) > first_name = forms.CharField(max_length=10, required=False) > last_name = forms.CharField(max_length=10, required=False) > email = forms.EmailField() > password = forms.CharField(max_length=16, widget=PasswordInput) > password_verify = forms.CharField( max_length=16,widget=PasswordInput) > > def clean_password(self): #here I added this methord > if self.is_valid(): > data = self.clean_data > if data['password'] != data['password_verify']: > #todo:some hacks here, maybe should change in the future > raise ValidationError(u'please check password') > > > It doesnt work. > > can you help me to fix my code ? > > > > -- Matt H <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

