Hi,
I am using django 1.8.7. I noticed that max_length for form is not working. The form validates even when the max_length is set and password length is more than 50 for following code. Though the min_length works fine.class AuthenticationForm(forms.Form)
email_mobile = forms.CharField(widget=forms.
password = forms.CharField(widget=forms.
remember_me = forms.BooleanField(widget=
def clean(self):
cleaned_data = super(AuthenticationForm, self).clean()
try:
if 'email_mobile' in self.cleaned_data:
int(self.cleaned_data['email_
if len(self.cleaned_data['email_
raise forms.ValidationError("Please provide a valid 10 digit mobile number.")
except (ValueError, TypeError):
if 'email_mobile' in self.cleaned_data:
validate_email(self.cleaned_
return self.cleaned_data
Am I doing something wrong or is it a bug ?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/12a685d0-d85d-4b76-929b-bc15c5cd847e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment