Opened 17 years ago

Closed 17 years ago

#3821 closed (fixed)

[patch] newforms.fields ChoiceField & MultipleChoiceField should honor widget overrides in subclasses

Reported by: Max Derkachev <mderk@…> Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

ChoiceField & MultipleChoiceField take a default widget argument in init, and it make impossible to override widget attribute on class level in subclasses. Instead of

class MyChoiceField(ChoiceField):
   widget = RadioSelect
..........
foo = MyChoiceField(choices=(....))

one must call it with widget argument every time:

foo = MyChoiceField(choices=(....), widget=RadioSelect)

Attachments (1)

fields_choices.patch (1.1 KB ) - added by Max Derkachev <mderk@…> 17 years ago.

Download all attachments as: .zip

Change History (4)

by Max Derkachev <mderk@…>, 17 years ago

Attachment: fields_choices.patch added

comment:1 by Simon G. <dev@…>, 17 years ago

Component: Uncategorizeddjango.newforms
Owner: changed from Jacob to Adrian Holovaty
Triage Stage: UnreviewedReady for checkin

comment:2 by Gary Wilson <gary.wilson@…>, 17 years ago

Max, in the future please create your diffs from the root of the django repository. This makes things a bit easier for anyone trying to use the patch. Thanks.

comment:3 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(In [5053]) Fixed #3821 -- Added a widget class attribute to ChoiceField and
MultipleChoiceField. This makes them consistent with other field classes and
make subclassing easier. This is a backwards compatible change. Thanks, Max
Dekachev.

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