On Thu, Mar 28, 2013 at 3:10 PM, amine antri <amine.antri@gmail.com> wrote:
> i'm working on Djnago and i need to know how can i get selected value in
> forms.ChoiceField
>
> class FilterForm(forms.Form):
> Continent = forms.ChoiceField(choices=continents())
>
> i tried with :
>
> def affiche_all(request, currency):
> if request.method == 'POST':
> form = FilterForm(request.POST)
> if form.is_valid() :
> Continent = form.cleaned_data['Continent']
At this point, 'Continent' (variables should have lower case names,
see PEP 8) should have the chosen value from the choices.
> Continent = dict(form.fields['Continent'])[Continent]
I have no idea what this is attempting to do.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment