Hi

Actually, the human readable value is not (‘Draft’) but _(‘Draft’) which is 
shorthand for gettext_lazy(‘Draft’)

Yves


> Le 22 févr. 2020 à 23:54, Nde Nguti <[email protected]> a écrit :
> 
> CHOICES =(('draft', 'Draft'), )
> 
> On Sun, Feb 23, 2020, 05:48 Yves de Champlain <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi
> 
> I'm using StatusModel from models_utils :
> 
> class MetaData(TimeStampedModel, StatusModel, SoftDeletableModel):
>     STATUS = Choices(('draft', _('Draft')),
>                      ('submitted', _('Submitted')),
>                      ('underreview', _('Underreview')),
>                       )
> 
> Forms using STATUS work as expected, but when I load an object from the DB, I 
> can't access the human readable data in my templates.
> 
> a.status => draft
> a.get_status_display => draft
> 
> instead of
> 
> a.status => draft
> a.get_status_display => Draft
> 
> Thanks for any hep on this !
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/d7a06913-39a8-4e55-9799-ebc46cb5cde4%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/d7a06913-39a8-4e55-9799-ebc46cb5cde4%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CALfkE84BbTc47u0TGL_PWYNXpoXjs0rsZUG4rjSBNySd8SLGyw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CALfkE84BbTc47u0TGL_PWYNXpoXjs0rsZUG4rjSBNySd8SLGyw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/C1C43B13-5D76-4C44-9979-F6D9E12D5F6F%40gmail.com.

Reply via email to