Hi I’ll know if it is much help if it solves my problem. I’ll have a look into that.
Thanks ! yves > Le 23 févr. 2020 à 02:32, Mike Dewhirst <[email protected]> a écrit : > > Maybe the choices should be > > STATUS = [ > ('draft', _('Draft')), > ... > ] > > I think the migration system might detect a change in the model every time it > is run because the get_text_lazy() function can return a non-static result. > Not sure about that. > > I haven't used _() myself but I have used methods to fill up choices lists > with just that outcome. I had to finalize the list prior to running migrate. > > Not much help I know > > Good luck > > Mike > > -------- Original message -------- > From: Yves de Champlain <[email protected]> > Date: 23/2/20 15:47 (GMT+10:00) > To: Django users <[email protected]> > Subject: get_FOO_display not working ? > > 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/5e522a9f.1c69fb81.cae91.b7f5SMTPIN_ADDED_MISSING%40gmr-mx.google.com > > <https://groups.google.com/d/msgid/django-users/5e522a9f.1c69fb81.cae91.b7f5SMTPIN_ADDED_MISSING%40gmr-mx.google.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/377B8ADD-1C7A-4418-BA76-3A12C325DC44%40gmail.com.

