Opened 8 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
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)

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 8 years ago.
0001-Fixed-widget-handling-in-ModelChoicesField.__init__.2.patch (2.2 KB) - added by sebastian_noack 8 years ago.
7244.patch (1.9 KB) - added by cgrady 8 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by sebastian_noack

  • Cc adrian added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 8 years ago by sebastian_noack

  • Cc adrian removed
  • Owner changed from nobody to adrian

comment:4 Changed 8 years ago by ramiro

  • Description modified (diff)

comment:5 Changed 8 years ago by ericholscher

  • milestone set to 1.0
  • Triage Stage changed from Unreviewed to Accepted

Changed 8 years ago by cgrady

comment:6 Changed 8 years ago by cgrady

  • Keywords aug22sprint added

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

comment:7 Changed 8 years ago by mtredinnick

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

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

Milestone 1.0 deleted

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