Ticket #3821: fields_choices.patch

File fields_choices.patch, 1.1 KB (added by Max Derkachev <mderk@…>, 18 years ago)
  • fields.py

     
    330330        return {True: True, False: False}.get(value, None)
    331331
    332332class 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)
    335337        self.choices = choices
    336338
    337339    def _get_choices(self):
     
    362364
    363365class MultipleChoiceField(ChoiceField):
    364366    hidden_widget = MultipleHiddenInput
     367    widget = SelectMultiple
    365368
    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 
    369369    def clean(self, value):
    370370        """
    371371        Validates that the input is a list or tuple.
Back to Top