mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
newforms: Fixed confusing behavior when setting choices for ChoiceFields and their corresponding Widgets. Now, a Widget uses the choices from its ChoiceField regardless of whether the Widget has its own choices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4378 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -319,7 +319,8 @@ class BooleanField(Field):
|
||||
class ChoiceField(Field):
|
||||
def __init__(self, choices=(), required=True, widget=Select, label=None, initial=None):
|
||||
if isinstance(widget, type):
|
||||
widget = widget(choices=choices)
|
||||
widget = widget()
|
||||
widget.choices = choices
|
||||
super(ChoiceField, self).__init__(required, widget, label, initial)
|
||||
self.choices = choices
|
||||
|
||||
|
||||
Reference in New Issue
Block a user