﻿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
19303	ModelAdmin.formfield_overrides is ignored for fields with choices	Ben Davis	Kundan Jangale	"Let's say we have custom field that extends CharField, which holds comma-separated values. Then, let's say we've made a custom widget that overrides CheckboxMultipleSelect, and takes the field's choices and combines them into comma-separated values, and we want to use that in the admin:

{{{#!python
    class MyModel(models.Model):
        foo = models.MyCustomField(choices=(('FOO', 'Foo'),('BAR', 'Bar')))

    class MyAdmin(admin.ModelAdmin):
         formfield_overrides = {
             MyCustomField: MyCustomWidget
         }
}}}


In ModelAdmin, the formfield_for_dbfield will normally check formfield_overrides to see if there are any overrides. That is, unless, the field has choices.  If the field has choices, formfield_for_choice_field is called, and formfield_overrides is ignored completely.

I know that there are other ways of overriding form fields, but it seems that ModelAdmin.formfield_overrides does not work as advertised."	Bug	assigned	contrib.admin	dev	Normal				Accepted	1	0	0	1	0	0
