TypedChoiceField is exactly like ChoiceField, except that ChoiceField always returns unicode.
With TypedChoiceField, you pass a function that takes one argument and returns a value other than the type you want. For example, if you want to force a value to an integer, use:
int_field = forms.TypedChoiceField(choices=SOME_CHOICES, coerce=int)
The field value will always be integer or invalid.
source share