Ticket #18162: form_class_for_choices.patch

File form_class_for_choices.patch, 726 bytes (added by Rafał Jagoda, 13 years ago)
  • django/db/models/fields/__init__.py

     
    474474            defaults['coerce'] = self.to_python
    475475            if self.null:
    476476                defaults['empty_value'] = None
    477             form_class = forms.TypedChoiceField
     477            form_class = kwargs.pop("form_class_for_choices", forms.TypedChoiceField)
    478478            # Many of the subclass-specific formfield arguments (min_value,
    479479            # max_value) don't apply for choice fields, so be sure to only pass
    480480            # the values that TypedChoiceField will understand.
Back to Top