Hi Chris,
get_SOMETHING_display() method is in model but not in Form. And I'm
asking about Forms... But thanks anyway.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
> class CustomForm( forms.Form):
> age = forms.ChoiceField(label='Age', choices=AGE_CHOICES)
>
> How can I get the value (not the key) of the age attribute after
> validation?
>
> if f.is_valid():
> cd = f.cleaned_data
>
> cd['age'] # returns the "key", not the value
Once you've saved th
> # Assume these are key-value pairs
> AGE_CHOICES=(
> (1, '0-3'),
> (2, '3-6'),
> (3, '6-15'),
> )
>
> class CustomForm(forms.Form):
> age = forms.ChoiceField(label='Age', choices=AGE_CHOICES)
>
> How can I get the value (not the key) of the age attribute after validation?
>
>
Hi group,
I have a form (from newforms) with choices
# Assume these are key-value pairs
AGE_CHOICES=(
(1, '0-3'),
(2, '3-6'),
(3, '6-15'),
)
class CustomForm(forms.Form):
age = forms.ChoiceField(label='Age', choices=AGE_CHOICES)
How can I get the value (not the key) of the age at
4 matches
Mail list logo