﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33193	Clarify enumeration types are true Python Enums	johnthagen	nobody	"https://docs.djangoproject.com/en/3.2/ref/models/fields/#field-choices-enum-types

I was originally hesitant to use the Django ""enumeration fields"" when I first read about them because to me the documentation made it sound like they were ""similar"" to Python Enums, but something different. I value using core data types for interop with other non-Django specific code, so I continued to use django-enumfields (https://github.com/hzdg/django-enumfields) for several releases. This allowed me to use true Python Enums which are familiar to use to developers not as versed in Django.

Recently I dug into the Django source code more deeply after hearing about them again and discovered that indeed the Choices type is really just an Enum with a little extra magic and some extra helper methods applied to them (and as such can be used as a normal Python Enum as well).

{{{
class ChoicesMeta(enum.EnumMeta):
    """"""A metaclass for creating a enum choices.""""""

...

class Choices(enum.Enum, metaclass=ChoicesMeta):
    """"""Class for creating enumerated choices.""""""
}}}

I would recommend modifying the docs in some way, for example:

> These work similar to enum from Python’s standard library, but with some modifications:

Could be reworded:

> These are true `Enum`s from Python's standard library, but with some additional extensions added:"	Cleanup/optimization	closed	Documentation	3.2	Normal	invalid	enum		Unreviewed	0	0	0	0	0	0
