So, what is the best way to throw a ValidationError only if None of
values a entered in subclassed field?

On 19 май, 23:10, Sam Chuparkoff <s...@sadach.org> wrote:
> On Mon, 2009-05-18 at 10:13 -0700, [CPR]-AL.exe wrote:
> > I've created a field+widget set that i use to render a number of
> > checkboxes and a TextInput with comma-separated values.
>
> > The problem is, when i set required = True, I get a ValidationError if
> > only checkboxes are selected (but i don't get it if TextInput is
> > filled)
>
> At least in 1.0.x, MultiValueField.clean will throw a validation error
> if self.required is True and one of that values in the value array is
> empty. I'm looking at django/forms/fields.py:800 :
>
>     if self.required and field_value in EMPTY_VALUES:
>         raise ValidationError(self.error_messages['required'])
>
> I don't understand why this should be the case, but if I'm reading
> correctly then you are reporting correctly as well :). Hope that
> helps.
>
> sdc
--~--~---------~--~----~------------~-------~--~----~
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