[Django] #24342: Add an EnumField as standard

46 views
Skip to first unread message

Django

unread,
Feb 14, 2015, 9:54:19 AM2/14/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
----------------------------------------------+--------------------
Reporter: ovangle | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer (models, ORM) | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
Add support for an `EnumField` which is backed by the corresponding `enum`
type if one exists in the database engine (eg. mysql, postgres), with a
default implementation of CharField in other database types and mapped to
instances of the `enum.Enum` (or `enum34.Enum` in python 2).

--
Ticket URL: <https://code.djangoproject.com/ticket/24342>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 14, 2015, 10:18:41 AM2/14/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
-------------------------------------+-------------------------------------

Reporter: ovangle | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 1.7
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by phalt):

* needs_docs: => 1
* needs_tests: => 1
* needs_better_patch: => 0


Comment:

This sounds like a good idea considering the new `enum` type in Python
3.4, but the `enum34` package would have to be added to Django's
requirements to support backwards compatibility for versions < 3.4.

Would this basically replace the need to use choices in `CharField`?

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:1>

Django

unread,
Feb 14, 2015, 10:19:56 AM2/14/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody
Type: New feature | Status: new

Component: Database layer | Version: 1.7
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by phalt):

* type: Uncategorized => New feature


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:2>

Django

unread,
Feb 15, 2015, 1:54:42 AM2/15/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: 1.7
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ovangle):

For us, it has replaced the use of choices everywhere, although we don't
use django forms (django only powers our REST API). The enum names are
stored in the database column and the implementation is agnostic to the
enum values. Our implementation is currently postgres specific, but should
be relatively easily to make generic.

But there are (dubious) use cases supported by choices that can't be
easily filled by enums (such as defining named groups of values in a
`<select>` form element), so I don't think choices can be deprecated
entirely. Perhaps an optional `form_groups` argument to `EnumField` would
satisfy this use case if a decision to deprecate choices were made in
response to this.

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:3>

Django

unread,
Feb 15, 2015, 6:35:20 PM2/15/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master

(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by knbk):

* version: 1.7 => master


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:4>

Django

unread,
Feb 21, 2015, 9:15:57 AM2/21/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

Could you please raise the issue on the DevelopersMailingList to see if
there is consensus to add this to core?

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:5>

Django

unread,
Mar 3, 2015, 9:48:47 AM3/3/15
to django-...@googlegroups.com
#24342: Add an EnumField as standard
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_docs: 1 => 0
* needs_tests: 1 => 0
* stage: Unreviewed => Someday/Maybe


Comment:

The [https://groups.google.com/d/topic/django-
developers/whVe0_lZxs4/discussion mailing list thread] didn't reveal a
strong consensus to add this to core at this time. My sense is that it
might be more appealing once the minimum version of Python that Django
supports has enums (3.4+).

The mailing list thread also noted [https://github.com/hzdg/django-
enumfields django-enumfields] as an active third-party implementation.

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:6>

Django

unread,
Mar 3, 2015, 9:49:23 AM3/3/15
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:7>

Django

unread,
Feb 4, 2016, 4:46:42 AM2/4/16
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mmoreaux):

Replying to [comment:7 timgraham]:

> The mailing list thread also noted ​django-enumfields as an active
third-party implementation.

It's worth noting though that django-enumfields is CharField-based and
doesn't use the database-specific enum types. So it's not a full
replacement for the feature requested here.

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:8>

Django

unread,
Apr 1, 2016, 12:53:38 PM4/1/16
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by frewsxcv):

If someone (maybe myself?) wrote a PostgreSQL specific `EnumField`, could
it be added to `django.contrib.postgres`?

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:9>

Django

unread,
Apr 1, 2016, 12:55:19 PM4/1/16
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by frewsxcv):

* cc: frewsxcv (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:10>

Django

unread,
Apr 1, 2016, 12:58:19 PM4/1/16
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: ovangle | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

The idea of a PostgreSQL-specific field was rejected on the mailing list
thread link in comment:6. Quoting Josh Smeaton:

I definitely do not like the idea of building a feature into
contrib.postgres that could be built for the rest of the database backends
too. It seems like a cop-out for doing less work, and really promotes one
built in backend above others. contrib.postgres should be a place for
postgres specific features, not for cutting out other backends.

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:11>

Django

unread,
Jan 23, 2017, 8:54:59 AM1/23/17
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by André Cruz):

* cc: andre@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:12>

Django

unread,
Aug 1, 2017, 6:18:52 AM8/1/17
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Anton Agestam):

Now that the next version of Django will drop support for Python versions
<3.5, will pull requests for this feature be considered?

Also thought it was worth mentioning https://github.com/5monkeys/django-
enumfield although it seems like it's no longer maintained and lacks
support from Django 1.8.

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:13>

Django

unread,
Aug 1, 2017, 8:57:57 AM8/1/17
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

Yes, a patch would certainly help advance the conversation -- particularly
if you can highlight the advantages of this as part of Django rather than
as a third-party package.

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:14>

Django

unread,
Aug 24, 2017, 4:20:03 AM8/24/17
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mahmoud Hossam):

I'm interested in implementing this feature, but I have a question
regarding backend support.

MySQL and PostgreSQL both have native types to support this feature, but
SQLite and Oracle don't.

How should we go about supporting this feature on those two databases?

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:15>

Django

unread,
Oct 20, 2017, 7:38:20 PM10/20/17
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ashley Waite):

I've implemented a POC that uses postgres and mysql enums (and will add a
fail to char for others) handling all the migrations cases (changing enum,
adding/removing values, etc).
https://github.com/ashleywaite/django-more/tree/master/django_enum

Is a pull to add these changes something that will be considered?

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:16>

Django

unread,
Jan 17, 2018, 9:24:17 AM1/17/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-----------------------------------+------------------------------------

Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by André Cruz):

* component: Database layer (models, ORM) => HTTP handling
* stage: Someday/Maybe => Accepted


Comment:

Yes, please!

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:17>

Django

unread,
Jan 17, 2018, 9:24:54 AM1/17/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------

Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |

Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by André Cruz):

* component: HTTP handling => Database layer (models, ORM)
* stage: Accepted => Someday/Maybe


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:18>

Django

unread,
Apr 4, 2018, 7:16:37 PM4/4/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Forbes):

* cc: Tom Forbes (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:19>

Django

unread,
Apr 16, 2018, 11:48:42 AM4/16/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Krzysztof Szularz):

* cc: Krzysztof Szularz (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:20>

Django

unread,
Apr 27, 2018, 8:26:57 AM4/27/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Olivier Tabone):

* cc: Olivier Tabone (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:21>

Django

unread,
Jul 24, 2018, 10:16:03 PM7/24/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kye Russell):

* cc: Kye Russell (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:22>

Django

unread,
Jul 31, 2018, 7:21:55 AM7/31/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Semyon Pupkov):

* cc: Semyon Pupkov (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:23>

Django

unread,
Aug 10, 2018, 6:57:28 AM8/10/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Stefan Foulis):

* cc: Stefan Foulis (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:24>

Django

unread,
Oct 12, 2018, 10:17:44 PM10/12/18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ryan Hiebert):

* cc: Ryan Hiebert (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:25>

Django

unread,
Jan 22, 2019, 7:52:29 AM1/22/19
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by safwanrahman):

* cc: safwanrahman (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:26>

Django

unread,
Feb 26, 2019, 5:14:24 AM2/26/19
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sévastien Fievet):

* cc: Sévastien Fievet (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:27>

Django

unread,
May 9, 2019, 9:33:01 AM5/9/19
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Paolo Melchiorre):

* cc: Paolo Melchiorre (added)


Old description:

> Add support for an `EnumField` which is backed by the corresponding
> `enum` type if one exists in the database engine (eg. mysql, postgres),
> with a default implementation of CharField in other database types and
> mapped to instances of the `enum.Enum` (or `enum34.Enum` in python 2).

New description:

Add support for an `EnumField` which is backed by the corresponding `enum`
type if one exists in the database engine (eg. mysql, postgres), with a
default implementation of CharField in other database types and mapped to
instances of the `enum.Enum`.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:28>

Django

unread,
May 22, 2019, 11:09:55 AM5/22/19
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Cesar Canassa):

* cc: Cesar Canassa (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:29>

Django

unread,
Sep 26, 2019, 9:49:27 AM9/26/19
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Duane Hutchins):

* cc: Duane Hutchins (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:30>

Django

unread,
Oct 31, 2019, 2:51:50 PM10/31/19
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hannes Ljungberg):

* cc: Hannes Ljungberg (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:31>

Django

unread,
Apr 9, 2020, 5:01:39 PM4/9/20
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam (Chainz) Johnson):

* cc: Adam (Chainz) Johnson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:32>

Django

unread,
Apr 9, 2020, 5:02:26 PM4/9/20
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

I have a MariaDB/MySQL stable implementation which I've used many times in
production. It can provide a starting point: https://django-
mysql.readthedocs.io/en/latest/model_fields/enum_field.html

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:33>

Django

unread,
Aug 6, 2020, 3:50:49 AM8/6/20
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

#31861 was a duplicate. Maybe the position is advanced some by the enum
choices available since 3.0.

Tim's comment:14 stills seems telling: a 3rd-party package showing what's
feasible is the first/next step, then a discussion of whether to bring
that into core.
(Wondering if this is wontfix pending such... 🤔)

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:34>

Django

unread,
Aug 6, 2020, 2:07:19 PM8/6/20
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by George Sakkis):

* cc: George Sakkis (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:35>

Django

unread,
Jul 7, 2023, 12:21:50 AM7/7/23
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev

(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Olivier Dalang):

* cc: Olivier Dalang (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:37>

Django

unread,
Mar 18, 2024, 3:13:47 AMMar 18
to django-...@googlegroups.com
#24342: Add EnumField model/form fields
-------------------------------------+-------------------------------------
Reporter: Thomas Stephenson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/24342#comment:38>
Reply all
Reply to author
Forward
0 new messages