I'm trying to subclass the ChoiceField so I can use it in multiple forms (DRY). For example:
class testField(forms.ChoiceField):
choices = (('a', 'b'), ('c', 'd'))
label = "test"
class testForm(forms.Form):
test = testField()
Other types of Fields work as subclasses (such as CharField), however when rendering the subclass of ChoiceField I get an obscure error:
AttributeError at /..url.../
'testField' object has no attribute '_choices'
Specifying the choices
as _choices
in the subclass doesn't report the error, but nor does it display the contents in the rendering.