> 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 the model, there's also the get_age_display() method 
(http://www.djangoproject.com/documentation/db-api/#get-foo-display). 
Looking at the code for that might give you more ideas.

Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to