[BangPypers] Getting label of the choicefield in django form
Gora Mohanty
gora at mimirtech.com
Sat Oct 22 08:58:04 CEST 2011
+On Sat, Oct 22, 2011 at 12:05 PM, Asif Jamadar
<asif.jamadar at rezayat.net> wrote:
[...]
> It is returning the value ( I,e attr1 or attr2) .in this case how can I get the label(or name) of the choicefield.
>
>
> I tried
>
> for val in cf.fields['value'].choices:
[...]
Since you created the form, would you not already know the labels?
In any case, what you are after is probably cf.fields['value'].label.title()
Regards,
Gora
More information about the BangPypers
mailing list