The way I have implemented this is to have to the validation occur at 
password2. 

Instead of having the check in clean, I would have the validation in 
clean_password2. 

Hope that helps. 
----- Original Message ----- 
From: [email protected] 
To: "Django users" <[email protected]> 
Sent: Monday, March 23, 2009 3:33:04 PM GMT -06:00 US/Canada Central 
Subject: django-registration - outputting errors 


Hello, 

I just started my first django project and I'm not sure how to print 
the errors from non_field_errors(). Here is the snippet from 
registration.forms.py: 

    def clean(self): 
        """ 
        Verifiy that the values entered into the two password fields 
        match. Note that an error here will end up in 
        ``non_field_errors()`` because it doesn't apply to a single 
        field. 

        """ 
        if 'password1' in self.cleaned_data and 'password2' in 
self.cleaned_data: 
            if self.cleaned_data['password1'] != self.cleaned_data 
['password2']: 
                raise forms.ValidationError(_(u'You must type the same 
password each time')) 
        return self.cleaned_data 

Here is my template snippet: 

{% if form.non_field_errors %} 
<p>Print the errors.</p> 
{% endif %} 

Thanks for any help, 

J 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to