﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31741	Admin site applies formfield_overrides for parent field class to instance of a child class	Mark Gregson	nobody	"If I have a custom model field that inherits from a builtin field and then use formfield_overrides to customise the form for the builtin field, those customisations are also applied to the custom field.

In this example, the override will also apply to a `CustomField` field on the model.

{{{#!python
class CustomField(models.TextField):
    ...

class SomeModelAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {""widget"": forms.Textarea},
    }
}}}

In my situation I am using a custom bleached field that sets a different default widget in its `formfield` method and it is counterintuitive to me that overriding `TextField` also overrides the custom implementation.  I expect that it would only override fields matching the class precisely, ie, override fields declared as `TextField` instances but not those declared as `CustomField`.

The code that implements this behaviour is `BaseModelAdmin.formfield_for_dbfield()` which traverses the MRO looking for any matching overrides. https://github.com/django/django/blob/master/django/contrib/admin/options.py#L179-L184  

I discovered it working with 2.2. The code looks unchanged from 2.2 to master, although I haven't tested in master.

If there is no appetite to change this behaviour, could break some folk's implementations, a note in the docs would be nice."	Bug	closed	contrib.admin	2.2	Normal	wontfix			Unreviewed	0	0	0	0	0	0
