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

The only problem is that you won't be able to raise the issue as a
field-specific error

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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