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
!
--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]>
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
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
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
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
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
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 ||
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
9 matches
Mail list logo