Opened 18 years ago
Closed 17 years ago
#4405 closed (invalid)
MultiValueField does not allow sub-fields to be blank
| Reported by: | Owned by: | Konrad Beiske | |
|---|---|---|---|
| Component: | Forms | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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/fields.py, 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 by , 18 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 17 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 17 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
comment:4 by , 17 years ago
| Status: | new → assigned |
|---|
comment:5 by , 17 years ago
| Resolution: | → invalid |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
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.