Django

Code

Ticket #3787 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] newforms.widgets.MultiWidget bugfixes

Reported by: Max Derkachev <mderk@yandex.ru> Assigned to: adrian
Milestone: Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

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

widgets_multiwidget.patch (1.1 kB) - added by Max Derkachev <mderk@yandex.ru> on 03/23/07 12:19:42.
3787.diff (1.1 kB) - added by Gary Wilson <gary.wilson@gmail.com> on 03/24/07 14:18:05.
diff from repository root and slightly more pythonic list comprehension using enumerate() instead of range(len())

Change History

03/23/07 12:19:42 changed by Max Derkachev <mderk@yandex.ru>

  • attachment widgets_multiwidget.patch added.

03/24/07 14:18:05 changed by Gary Wilson <gary.wilson@gmail.com>

  • attachment 3787.diff added.

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

03/24/07 14:23:03 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests set to 1.
  • needs_docs changed.

We should have some MultiWidget? form-processing tests.

04/24/07 07:53:30 changed by russellm

(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.

04/26/07 07:46:04 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(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.


Add/Change #3787 ([patch] newforms.widgets.MultiWidget bugfixes)




Change Properties
Action