On Sat, Oct 22, 2011 at 1:32 PM, Asif Jamadar wrote:
> Can you explain this with example so that I can understand?
GENDERS = (
('U', 'Unspecified',),
('M', 'Male',),
('F', 'Female'),
)
Now, say you have a
gender = forms.ChoiceField( label='Gender', choices=GROUPS )
after validati
Can you explain this with example so that I can understand?
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
On Sat, Oct 22, 2011 at 12:45 PM, Asif Jamadar wrote:
> But I have same lables( or names) in my choice list
>
> Choices = [ ('attr1', 1), ('attr1', 2), ('attr1' , 3) , ('attr2', 1),
> ('attr2', 2), ('attr2', 3) ]
>
> All these are displayed as radio buttons.
>
> When I select 2 then it is returni
But I have same lables( or names) in my choice list
Choices = [ ('attr1', 1), ('attr1', 2), ('attr1' , 3) , ('attr2', 1), ('attr2',
2), ('attr2', 3) ]
All these are displayed as radio buttons.
When I select 2 then it is returning me "attr1". But how should I get the value
itself that is "2"?
+On Sat, Oct 22, 2011 at 12:05 PM, Asif Jamadar
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 kno
I have django form which consist of one choice field with following choices
Choices = [('attr1', 1), ('attr1', 2), ('attr3',3), ('attr2',1), ('attr2',2),
('attr2', 3)]
If I do value = form.cleaned_data('value')
It is returning the value ( I,e attr1 or attr2) .in this case how can I get the
la