Code

Opened 6 years ago

Closed 6 years ago

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

Download all attachments as: .zip

Change History (11)

comment:1 Changed 6 years ago by sebastian_noack

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

comment:2 Changed 6 years ago by sebastian_noack

  • Cc adrian removed
  • Owner changed from nobody to adrian

comment:4 Changed 6 years ago by ramiro

  • Description modified (diff)

comment:5 Changed 6 years ago by ericholscher

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

Changed 6 years ago by cgrady

comment:6 Changed 6 years ago by cgrady

  • Keywords aug22sprint added

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

comment:7 Changed 6 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 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.