diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-08 20:25:56 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-08 20:25:56 +0000 |
| commit | f55f2b9d74bf59d1b3ace5df5f498998eb62cb28 (patch) | |
| tree | 0d8c11839c7d8ee8ef463e080e0fbf91be68058e /django | |
| parent | 6eaf154a2e81d21d02f3597dd0e3dad01db8d07c (diff) | |
Fixed #10059: `ModelAdmin.formfield_for_dbfield` now handles custom `Field` subclasses. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10454 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/options.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index e798587040..c87d903ec5 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -108,9 +108,10 @@ class BaseModelAdmin(object): # If we've got overrides for the formfield defined, use 'em. **kwargs # passed to formfield_for_dbfield override the defaults. - if db_field.__class__ in self.formfield_overrides: - kwargs = dict(self.formfield_overrides[db_field.__class__], **kwargs) - return db_field.formfield(**kwargs) + for klass in db_field.__class__.mro(): + if klass in self.formfield_overrides: + kwargs = dict(self.formfield_overrides[klass], **kwargs) + return db_field.formfield(**kwargs) # For any other type of field, just call its formfield() method. return db_field.formfield(**kwargs) |
