Ticket #6967: choices-fix.patch

File choices-fix.patch, 601 bytes (added by Simon Willison, 17 years ago)
  • django/db/models/fields/__init__.py

     
    490490
    491491    def formfield(self, **kwargs):
    492492        defaults = {'max_length': self.max_length}
     493        if self._choices:
     494            defaults['form_class'] = forms.ChoiceField
     495            defaults['choices'] = self._choices
     496            del defaults['max_length']
    493497        defaults.update(kwargs)
    494498        return super(CharField, self).formfield(**defaults)
    495499
Back to Top