Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 15d5c3decb79c8a1af7131b8e53d12181c790e2f 1 parent 2a512a4
Malcolm Tredinnick authored April 21, 2007
1  AUTHORS
@@ -78,6 +78,7 @@ answer newbie questions, and generally made Django that much better:
78 78
     Jason Davies (Esaj) <http://www.jasondavies.com/>
79 79
     Alex Dedul
80 80
     deric@monowerks.com
  81
+    Max Derkachev <mderk@yandex.ru>
81 82
     dne@mayonnaise.net
82 83
     Maximillian Dornseif <md@hudora.de>
83 84
     Jeremy Dunck <http://dunck.us/>
8  django/newforms/fields.py
@@ -332,7 +332,9 @@ def clean(self, value):
332 332
         return {True: True, False: False}.get(value, None)
333 333
 
334 334
 class ChoiceField(Field):
335  
-    def __init__(self, choices=(), required=True, widget=Select, label=None, initial=None, help_text=None):
  335
+    widget = Select
  336
+
  337
+    def __init__(self, choices=(), required=True, widget=None, label=None, initial=None, help_text=None):
336 338
         super(ChoiceField, self).__init__(required, widget, label, initial, help_text)
337 339
         self.choices = choices
338 340
 
@@ -364,9 +366,7 @@ def clean(self, value):
364 366
 
365 367
 class MultipleChoiceField(ChoiceField):
366 368
     hidden_widget = MultipleHiddenInput
367  
-
368  
-    def __init__(self, choices=(), required=True, widget=SelectMultiple, label=None, initial=None, help_text=None):
369  
-        super(MultipleChoiceField, self).__init__(choices, required, widget, label, initial, help_text)
  369
+    widget = SelectMultiple
370 370
 
371 371
     def clean(self, value):
372 372
         """

0 notes on commit 15d5c3d

Please sign in to comment.
Something went wrong with that request. Please try again.