Tags - enum

An alternative to Enum for Choices

Those who've been reading my older posts may remember I showed how you could use Enum and IntEnum as a cleaner way to declare const-type values for choices lists in Django fields.

That solution never felt comfortable to me, because Enum values aren't simple values.

So after some playing around, and a brief look over the enum.py in python 3.5, I've come up with the following:

IntEnum for Choices in Django

So, we've all needed a choices list in Django at one time or another, right?

And from the docs we see the example code:

    ('FR', 'Freshman'),
    ('SO', 'Sophomore'),
    ('JR', 'Junior'),
    ('SR', 'Senior'),