Ticket #3991: choices.diff

File choices.diff, 837 bytes (added by Baptiste <baptiste.goupil@…>, 17 years ago)
  • contrib/admin/options.py

     
    237237            else:
    238238                # Wrap the widget's render() method with a method that adds
    239239                # extra HTML to the end of the rendered output.
    240240                formfield = db_field.formfield(**kwargs)
    241241                formfield.widget.render = widgets.RelatedFieldWidgetWrapper(formfield.widget.render, db_field.rel)
    242242                return formfield
    243243
     244        if db_field._choices:
     245            kwargs['widget'] = forms.widgets.Select(choices=db_field._choices)
     246           
    244247        # For any other type of field, just call its formfield() method.
    245248        return db_field.formfield(**kwargs)
Back to Top