I have a ChoiceField
, now how do I get the label when I need it?
class ContactForm(forms.Form):
reason = forms.ChoiceField(choices=[("feature", "A feature"),
("order", "An order")],
widget=forms.RadioSelect)
form.cleaned_data["reason"]
only gives me the feature
or order
values or so.
This may help:
reason = form.cleaned_data['reason']
reason = dict(form.fields['reason'].choices)[reason]