Try something like this:
field = form.fields['property']
data = form.cleaned_data['property']
if isinstance(data, (list, tuple)):
# for multi-selects
friendly_name = [x[1] for x in field.field.choices if x[0] in
data]
else:
If have a ChoiceField in a form (sometimes dynamically changed with
javascript) when getting the cleaned_data for that field it will
always return the value.
i.e:
Property1
self.cleaned_data.get('property') will always return '1'
How can i access the displayed value 'Property1' ?
Thanks
-Da
2 matches
Mail list logo