Hey Shai, I have not had a chance to look at the implementation, but I was describing my django-choice-object library and forgot to link it!
I would be +1 on re-opening it, I've used enums for this before and I find it much more DRY than the more 'standard' Django way. Perhaps we could reduce some boilerplate here by somehow automatically adding the key names to gettext? 1. https://github.com/orf/django-choice-object On Mon, 31 Dec 2018, 18:19 Shai Berger <s...@platonix.com wrote: > Hi all, > > Lately I've run into ticket 27910, which asks for Python Enums to be > usable for generating choices in Django model (and form) fields. This > ticket was closed Wontfix because the original suggestion did not offer > any way to handle translated labels. However, after the ticket was > closed, Tom Forbes brought up a suggestion for a suitable API; > regretfully, AFAICT this suggestion was never discussed here, and (at > least on the ticket) Tom hasn't shared his implementation. > > Inspired by his description, I came up with an implementation that is > simple -- less than 20 lines of executable code -- and I think has a > lot of nice properties. I think this can make choices-related code > significantly more elegant. > > May we please reopen the ticket? > > Thanks, > Shai. > >  https://code.djangoproject.com/ticket/27910 >  > https://github.com/django/django/compare/master...shaib:ticket_27910?expand=1 > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to email@example.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/20181231201915.6709633b.shai%40platonix.com > . > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to firstname.lastname@example.org. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFNZOJMie_bAtpFHti2Qk59P0kU2LF4ENLtfvFd%2BiZGuQHDNVg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.