Fixed `ModelAdmin.radio_fields` to work with the new `TypedChoiceField`.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-08-31 20:11:28 +00:00
parent 3b63953704
commit 8b11341a9a
1 changed files with 6 additions and 6 deletions

View File

@ -51,12 +51,12 @@ class BaseModelAdmin(object):
if db_field.choices: if db_field.choices:
if db_field.name in self.radio_fields: if db_field.name in self.radio_fields:
# If the field is named as a radio_field, use a RadioSelect # If the field is named as a radio_field, use a RadioSelect
kwargs['widget'] = widgets.AdminRadioSelect( kwargs['widget'] = widgets.AdminRadioSelect(attrs={
choices=db_field.get_choices(include_blank=db_field.blank, 'class': get_ul_class(self.radio_fields[db_field.name]),
blank_choice=[('', _('None'))]), })
attrs={ kwargs['choices'] = db_field.get_choices(
'class': get_ul_class(self.radio_fields[db_field.name]), include_blank = db_field.blank,
} blank_choice=[('', _('None'))]
) )
return db_field.formfield(**kwargs) return db_field.formfield(**kwargs)
else: else: