Re: How to find the label for a value

2006-02-13 Thread [EMAIL PROTECTED]
Luke Plant wrote: > > context['choices'] = CHOICES.items() > > Just remembered - this doesn't guarantee ordering, you'll need to handle > sorting of the choices list somehow. the obvious way being CHOICES = ( (1, 'Choice 1'), (2, 'Choice 2'), ) context['choices'] = CHOICES try: cho

RE: How to find the label for a value

2006-02-13 Thread Leeuw van der, Tim
!   --Tim   From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Amit Upadhyay Sent: maandag 13 februari 2006 11:53 To: django-users@googlegroups.com Subject: Re: How to find the label for a value   On 2/13/06, Leeuw van der, Tim <[EMAIL PROTECTED]>

Re: How to find the label for a value

2006-02-13 Thread Amit Upadhyay
On 2/13/06, Leeuw van der, Tim <[EMAIL PROTECTED]> wrote: The choices for the form are specified in your model. Django uses thesechoices for it's form-display.It would make sense to me if Django would also provide an easy way foryou to display such 'nice' values in your interface. Django already do

Re: How to find the label for a value

2006-02-13 Thread Amit Upadhyay
On 2/11/06, Luke Plant <[EMAIL PROTECTED]> wrote: On Saturday 11 February 2006 13:14, Luke Plant wrote:>   context['choices'] = CHOICES.items()Just remembered - this doesn't guarantee ordering, you'll need to handlesorting of the choices list somehow. http://aspn.activestate.com/ASPN/Cookbook/P

RE: How to find the label for a value

2006-02-13 Thread Leeuw van der, Tim
groups.com [mailto:[EMAIL PROTECTED] On Behalf Of Malcolm Tredinnick Sent: maandag 13 februari 2006 10:00 To: Django users Subject: Re: How to find the label for a value PythonistL wrote: > Luke, > Thanks for your reply.But I am not sure I fully understand your reply. > (I might have put my

Re: How to find the label for a value

2006-02-13 Thread Malcolm Tredinnick
PythonistL wrote: > Luke, > Thanks for your reply.But I am not sure I fully understand your reply. > (I might have put my question in a not clear way). > All that I need is to render the user's choice so that in a template > there is no value but the label. > > E.g. the new_data( taken from a for

Re: How to find the label for a value

2006-02-13 Thread PythonistL
Luke, Thanks for your reply.But I am not sure I fully understand your reply. (I might have put my question in a not clear way). All that I need is to render the user's choice so that in a template there is no value but the label. E.g. the new_data( taken from a form ) may be like this: {'Passwo

Re: How to find the label for a value

2006-02-11 Thread Luke Plant
On Saturday 11 February 2006 13:14, Luke Plant wrote: > context['choices'] = CHOICES.items() Just remembered - this doesn't guarantee ordering, you'll need to handle sorting of the choices list somehow. Luke -- Life is complex. It has both real and imaginary components. Luke Plant ||

Re: How to find the label for a value

2006-02-11 Thread Luke Plant
On Saturday 11 February 2006 10:53, PythonistL wrote: > > Choice 1 > Choice2 > > > It is easy to find the value( here 1 and 2) but how, in Django , can > I find the label( here Choice 1 and Choice2) ? > E.g. when a user chooses the first option, I need to know that the > choosen label