Opened 18 years ago
Closed 18 years ago
#3787 closed (fixed)
[patch] newforms.widgets.MultiWidget bugfixes
Reported by: | 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:
- render() does not generate different element ids for different sub-widgets, so every sub-widget gets the same id
- render() checks for KeyError while enumerating self.widgets, while it should check for IndexError instead
- 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)
Change History (5)
by , 18 years ago
Attachment: | widgets_multiwidget.patch added |
---|
by , 18 years ago
comment:1 by , 18 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
We should have some MultiWidget form-processing tests.
comment:2 by , 18 years ago
comment:3 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(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.
diff from repository root and slightly more pythonic list comprehension using enumerate() instead of range(len())