Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#7244 closed (fixed)

ModelChoicesField.__init__ and ModelMultipleChoicesField.__init__ must not pass a widget to the parent __init__.

Reported by: Sebastian Noack Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: Keywords: aug22sprint
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Ramiro Morales)

There is a bug in the ModelChoicesField and ModelMultipleChoicesField from django.newforms.models, which passed Select or MultipleSelect as default widget to the parent __init__ if not specified. This breaks the ability to set the widget class attribute in derived classes. I wrote a patch, that fixes this.

Attachments (3)

0001-Fixed-widget-handling-in-ModelChoicesField.__init__.patch (2.5 KB) - added by Sebastian Noack 9 years ago.
0001-Fixed-widget-handling-in-ModelChoicesField.__init__.2.patch (2.2 KB) - added by Sebastian Noack 9 years ago.
7244.patch (1.9 KB) - added by Collin Grady 8 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by Sebastian Noack

Cc: Adrian Holovaty added

comment:2 Changed 9 years ago by Sebastian Noack

Cc: Adrian Holovaty removed
Owner: changed from nobody to Adrian Holovaty

comment:4 Changed 8 years ago by Ramiro Morales

Description: modified (diff)

comment:5 Changed 8 years ago by Eric Holscher

milestone: 1.0
Triage Stage: UnreviewedAccepted

Changed 8 years ago by Collin Grady

Attachment: 7244.patch added

comment:6 Changed 8 years ago by Collin Grady

Keywords: aug22sprint added

FilePathField did the same thing - updated patch, fields still work, tests still pass

comment:7 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [8489]) Fixed #7244 -- Allow widget overriding in subclasses for ModelChoiceField,
ModelMultipleChoiceField and FilePathField. Patch from Sebastian Noack and
Colin Grady.

comment:8 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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