Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7082 closed (invalid)

newforms Multivalue.clean() strange behavior

Reported by: leotr Owned by: nobody
Component: Forms Version: master
Severity: Keywords: newforms multivaluefield clean
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi!
I have a question about newforms MultiValueField.clean() method:

for i, field in enumerate(self.fields):

try:

field_value = value[i]

except IndexError:

field_value = None

if self.required and field_value in EMPTY_VALUES:

#
# |
# Why here is self.required? What if i allow some fields in
# some cases to be empty? Is it a bug and 'field.required'
# should be instead of 'self.required'?
#

Regards,
Leo Trubach

Change History (3)

comment:1 Changed 7 years ago by leotr

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
Hi!
I have a question about newforms MultiValueField.clean() method:

        for i, field in enumerate(self.fields):
            try:
                field_value = value[i]
            except IndexError:
                field_value = None
            if self.required and field_value in EMPTY_VALUES:

#           ^
#           |
#           Why here is self.required? What if i allow some fields in
#           some cases to be empty? Is it a bug and 'field.required'
#           should be instead of 'self.required'?
#

Regards,
Leo Trubach

comment:2 Changed 7 years ago by oyvind

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

comment:3 Changed 7 years ago by mtredinnick

Support questions should be asked on the mailing list, not in Trac, please.

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