Re: get choice value in Form

2007-12-09 Thread F7
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

Re: get choice value in Form

2007-12-07 Thread Chris Brand
> 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

Re: get choice value in Form

2007-12-07 Thread Tim Chase
> # 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? > >

get choice value in Form

2007-12-07 Thread Frank 7200
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