#19303: ModelAdmin.formfield_overrides is ignored for fields with choices -------------------------------+-------------------- Reporter: bendavis78 | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 1.4 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- 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. -- Ticket URL: <https://code.djangoproject.com/ticket/19303> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.