0
我想验证我的注册表单。我使用djanga注册,它已经有密码验证功能。在django中显示密码验证错误
在我的登记表,我使用这个功能:
{% if form.errors %}
{% for field in form %}
<div class="error_message">
{{ field.errors }}
</div>
{% endfor %}
{% endif %}
它显示除密码匹配验证这是所有错误:
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
在我的另一种观点,更改密码,它显示密码匹配验证,但不是我写的(“不不不”),我认为它显示默认的。
那么有什么想法?
THX,现在它的工作原理=)我错过那部分 – iva123 2011-03-13 10:21:10