Ticket #3821: fields_choices.patch
File fields_choices.patch, 1.1 KB (added by , 18 years ago) |
---|
-
fields.py
330 330 return {True: True, False: False}.get(value, None) 331 331 332 332 class ChoiceField(Field): 333 def __init__(self, choices=(), required=True, widget=Select, label=None, initial=None, help_text=None): 334 super(ChoiceField, self).__init__(required, widget, label, initial, help_text) 333 widget = Select 334 335 def __init__(self, choices=(), *args, **kwargs): 336 super(ChoiceField, self).__init__(*args, **kwargs) 335 337 self.choices = choices 336 338 337 339 def _get_choices(self): … … 362 364 363 365 class MultipleChoiceField(ChoiceField): 364 366 hidden_widget = MultipleHiddenInput 367 widget = SelectMultiple 365 368 366 def __init__(self, choices=(), required=True, widget=SelectMultiple, label=None, initial=None, help_text=None):367 super(MultipleChoiceField, self).__init__(choices, required, widget, label, initial, help_text)368 369 369 def clean(self, value): 370 370 """ 371 371 Validates that the input is a list or tuple.