Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 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

Attachments (0)

Change History (3)

comment:1 Changed 6 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 6 years ago by oyvind

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

comment:3 Changed 6 years ago by mtredinnick

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.