Django

Code

Ticket #3821 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

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

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

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

fields_choices.patch (1.1 kB) - added by Max Derkachev <mderk@yandex.ru> on 03/26/07 04:19:53.

Change History

03/26/07 04:19:53 changed by Max Derkachev <mderk@yandex.ru>

  • attachment fields_choices.patch added.

03/26/07 06:02:07 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • component changed from Uncategorized to django.newforms.
  • needs_tests changed.
  • owner changed from jacob to adrian.
  • needs_docs changed.
  • stage changed from Unreviewed to Ready for checkin.

03/28/07 16:38:07 changed by Gary Wilson <gary.wilson@gmail.com>

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.

04/21/07 00:43:32 changed by mtredinnick

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

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


Add/Change #3821 ([patch] newforms.fields ChoiceField & MultipleChoiceField should honor widget overrides in subclasses)




Change Properties
Action