Opened 9 years ago

Closed 7 years ago

#4405 closed (invalid)

MultiValueField does not allow sub-fields to be blank

Reported by: adurdin@… Owned by: beiske
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


If even one of a MultiValueField's sub-fields is blank, a ValidationError is raised, even if that sub-field had required=False

In django/newforms/, line 530

            if self.required and field_value in EMPTY_VALUES:
                raise ValidationError(gettext(u'This field is required.'))

Line 530 should be changed to check the sub-field's required attribute:

            if field.required and field_value in EMPTY_VALUES:

Change History (5)

comment:1 Changed 8 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 7 years ago by Konrad Beiske <konrad@…>

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:3 Changed 7 years ago by beiske

  • Owner changed from anonymous to beiske
  • Status changed from assigned to new

comment:4 Changed 7 years ago by beiske

  • Status changed from new to assigned

comment:5 Changed 7 years ago by beiske

  • Resolution set to invalid
  • Status changed from assigned to closed

MultiValueField is currently made to completely ignore the required field setting of it's subfields. In fact it's init method sets all subfields as not required. It does allow subfields to be blank it self is allowed to be blank as well. Subclasses can allow some fields blank and some not in the compress function.

Note: See TracTickets for help on using tickets.
Back to Top