Update:

If I pass required=False to the field that belongs to a
MultiValueFields it doesn't take that into account since only sees for
the required in the MultiValueField instance.

As I see in the MultiValueField.clean method

forms/fields.py line 801 of django 1.1 stable

if self.required and field_value in EMPTY_VALUES:
                raise ValidationError(self.error_messages['required'])
            try:
                clean_data.append(field.clean(field_value))
            except ValidationError, e:
                # Collect all validation errors in a single list,
which we'll
                # raise at the end of clean(), rather than raising a
single
                # exception for the first error we encounter.
                errors.extend(e.messages)

That line could be

if field.required and field_value in EMPTY_VALUES:
...

I can override the clean method, but I thing this change is a better
option.

Any comments?

Regards

On Sep 30, 2:08 pm, eka <ekagauranga...@gmail.com> wrote:
> Hi All.
>
> When using MultiValueField if I set required=False in my field Any of
> the form fields can be empty, but if required is default to True, None
> of the field can be empty or blank... isn't there a middle ground?
>
> In the case where I'm using 2 fields and I wan't only the first to
> allow blank values?
>
> How this can be achieved?
>
> regards
--~--~---------~--~----~------------~-------~--~----~
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