I’m trying to validate my registration form. I’m using djanga-registration, it already has password validation function.
In my registration form, I’m using this function :
{% if form.errors %}
{% for field in form %}
<div class="error_message">
{{ field.errors }}
</div>
{% endfor %}
{% endif %}
It displays all errors except the password matching validation which is:
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'no no no'))
return self.cleaned_data
In my other view , change password, it displays password matching validation, but not the one i wrote (“no no no”), i think it displays the default one.
So any ideas ?
looks like you implemented the view correctly but your template doesn’t have:
http://docs.djangoproject.com/en/dev/topics/forms/#form-objects