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