﻿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
9245	Using choices in a mode field forces use of TypedChoiceField in a form field	Joey Wilhelm	Badri	"For most field types, I can override the class used to display the field with:
{{{
#!python
def formfield(self, **kwargs):
    defaults = {'form_class': CustomFormField}
    defaults.update(kwargs)
    return super(MyFieldClass, self).formfield(**defaults)
}}}
However, the Field class specifically overrides this when the field has 'choices'.
Lines 311-326 of django/db/models/fields/__init__.py contain the offending code. The specific override is on line 318:
{{{
#!python
form_class = forms.TypedChoiceField
}}}
In my case, I have a subclass of TypedChoiceField which I would like to use to display the field. Instead of the simple bit of code shown above, however, I had to duplicate the entire formfield function from the base Field class, and change that one offending line."	Bug	closed	Forms	1.0	Normal	fixed		mmitar@… s.kuzmenko@… lukasz@… David Gouldin	Accepted	1	1	0	0	0	0
