On Thu, Feb 26, 2009 at 4:36 AM, Matej <matej.pun...@gmail.com> wrote:

>
> Hello.
> I would like to get my translated text from ugettext_lazy() result.
> How can I do that?
>
> Example:
> http://dpaste.com/1744/
>
> #models.py
> RATING_CHOICES = (
>    ('0', _('I don\'t know')),
>    ('1', _('Very bad')),
>    ('2', _('Bad')),
>    ('3', _('OK')),
>    ('4', _('Good')),
>    ('5', _('Excelent')),
> )
>
> #extra_tags.py
> @register.simple_tag
> def show_webstore_user_ratings(user_ratings):
>    A = RATING_CHOICES[user_ratings]
>    return A[1]
>
> >
>
Perhaps you're looking for this method:
http://docs.djangoproject.com/en/dev/ref/models/instances/#get-foo-display

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to