On 2012.07.26. 17:44, Tomas Neme wrote:
class Form(forms.Form):

     check = forms.BooleanField(
         required=False,
     )
     # take into account only when 'check' is True
     len = forms.IntegerField(
         min_value=3,
         max_value=5,
         required=True,
     )


What I want is to validate the 'len' field only when 'check' is True.
I could define the clean method of the form and validate the required,
min_value and max_value stuff only when 'check' is True but the case when
someone types a non integer value into the input is still there. How could I
skip that? That check is done by the IntegerField.
well, you could override clean_len() and not do anything in it, and
then override clean() and do your check there.


I don't think that would help. The clean method of the Field (IntegerField in this case) would still run.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to