mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
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
This commit is contained in:
@@ -332,7 +332,9 @@ class NullBooleanField(BooleanField):
|
||||
return {True: True, False: False}.get(value, None)
|
||||
|
||||
class ChoiceField(Field):
|
||||
def __init__(self, choices=(), required=True, widget=Select, label=None, initial=None, help_text=None):
|
||||
widget = Select
|
||||
|
||||
def __init__(self, choices=(), required=True, widget=None, label=None, initial=None, help_text=None):
|
||||
super(ChoiceField, self).__init__(required, widget, label, initial, help_text)
|
||||
self.choices = choices
|
||||
|
||||
@@ -364,9 +366,7 @@ class ChoiceField(Field):
|
||||
|
||||
class MultipleChoiceField(ChoiceField):
|
||||
hidden_widget = MultipleHiddenInput
|
||||
|
||||
def __init__(self, choices=(), required=True, widget=SelectMultiple, label=None, initial=None, help_text=None):
|
||||
super(MultipleChoiceField, self).__init__(choices, required, widget, label, initial, help_text)
|
||||
widget = SelectMultiple
|
||||
|
||||
def clean(self, value):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user