Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 8b11341a9a706f2a239d9e4eec1c093b4e93fecb 1 parent 3b63953
Jacob Kaplan-Moss authored

Showing 1 changed file with 6 additions and 6 deletions. Show diff stats Hide diff stats

  1. 12  django/contrib/admin/options.py
12  django/contrib/admin/options.py
@@ -51,12 +51,12 @@ def formfield_for_dbfield(self, db_field, **kwargs):
51 51
         if db_field.choices:
52 52
             if db_field.name in self.radio_fields:
53 53
                 # If the field is named as a radio_field, use a RadioSelect
54  
-                kwargs['widget'] = widgets.AdminRadioSelect(
55  
-                    choices=db_field.get_choices(include_blank=db_field.blank,
56  
-                        blank_choice=[('', _('None'))]),
57  
-                    attrs={
58  
-                        'class': get_ul_class(self.radio_fields[db_field.name]),
59  
-                    }
  54
+                kwargs['widget'] = widgets.AdminRadioSelect(attrs={
  55
+                    'class': get_ul_class(self.radio_fields[db_field.name]),
  56
+                })
  57
+                kwargs['choices'] = db_field.get_choices(
  58
+                    include_blank = db_field.blank,
  59
+                    blank_choice=[('', _('None'))]
60 60
                 )
61 61
                 return db_field.formfield(**kwargs)
62 62
             else:

0 notes on commit 8b11341

Please sign in to comment.
Something went wrong with that request. Please try again.