Ok, that’s great – Is it possible to call this function without any arguments though, so that it can be used directly in templates? (I guess that yes; and in that case it looks like exactly what the OP (and me) want, provided that the OP indeed is displaying values from a Model)

 

Thanks!

 

--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]> wrote:


The choices for the form are specified in your model. Django uses these
choices for it's form-display.
It would make sense to me if Django would also provide an easy way for
you to display such 'nice' values in your interface.


Django already does it. If you have specified choices for any member my_member of model MyModel, django will add a get_my_member_display() function to MyModel objects.


--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701

Reply via email to