Opened 18 years ago

Closed 18 years ago

#3787 closed (fixed)

[patch] newforms.widgets.MultiWidget bugfixes

Reported by: Max Derkachev <mderk@…> Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found 3 problems with MultiWidget:

  1. render() does not generate different element ids for different sub-widgets, so every sub-widget gets the same id
  2. render() checks for KeyError while enumerating self.widgets, while it should check for IndexError instead
  3. value_from_datadict() should use sub-widget.value_from_datadict() instead of using data.get (sub-widgets can be other multiwidgets or SelectMultiples)

Attachments (2)

widgets_multiwidget.patch (1.1 KB ) - added by Max Derkachev <mderk@…> 18 years ago.
3787.diff (1.1 KB ) - added by Gary Wilson <gary.wilson@…> 18 years ago.
diff from repository root and slightly more pythonic list comprehension using enumerate() instead of range(len())

Download all attachments as: .zip

Change History (5)

by Max Derkachev <mderk@…>, 18 years ago

Attachment: widgets_multiwidget.patch added

by Gary Wilson <gary.wilson@…>, 18 years ago

Attachment: 3787.diff added

diff from repository root and slightly more pythonic list comprehension using enumerate() instead of range(len())

comment:1 by Gary Wilson <gary.wilson@…>, 18 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

We should have some MultiWidget form-processing tests.

comment:2 by Russell Keith-Magee, 18 years ago

(In [5065]) Fixed #3870, Refs #3787 -- Fixed handling of widget attributes on RadioSelect and MultiWidget. In particular, handling of the id attribute has been fixed. Thanks to Gary Wilson and Max Derkachev.

comment:3 by Russell Keith-Magee, 18 years ago

Resolution: fixed
Status: newclosed

(In [5088]) Fixed #3787, #3788 -- Corrected check for IndexError on MultiValueField, and fixed the value_from_datadict method for MultiWidgets to handle Multiwidgets containing Multiwidgets. Also added a testcase walking through the use of MultiWidget/MultiValueField. Thanks to Max Derkachev for reporting these issues and providing fixes.

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