Ticket #10059: admin-widgets.diff

File admin-widgets.diff, 966 bytes (added by Alex Gaynor, 16 years ago)

use the mro

  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index ed41c7f..99b7323 100644
    a b class BaseModelAdmin(object):  
    105105                   
    106106        # If we've got overrides for the formfield defined, use 'em. **kwargs
    107107        # passed to formfield_for_dbfield override the defaults.
    108         if db_field.__class__ in self.formfield_overrides:
    109             kwargs = dict(self.formfield_overrides[db_field.__class__], **kwargs)
    110             return db_field.formfield(**kwargs)
     108        for klass in db_field.__class__.mro():
     109            if klass in self.formfield_overrides:
     110                kwargs = dict(self.formfield_overrides[klass], **kwargs)
     111                return db_field.formfield(**kwargs)
    111112                       
    112113        # For any other type of field, just call its formfield() method.
    113114        return db_field.formfield(**kwargs)
Back to Top