#31057: Choices enum - Inconsistent values.
-------------------------------------+-------------------------------------
Reporter: laevilgenius | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: enum | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):
* status: new => closed
* cc: Shai Berger, Nick Pope (added)
* resolution: => invalid
Comment:
`Choices` are supported if you need a concrete data type other than `int`
or `str`. In such cases you should subclass `Choices` **and the required
concrete data type** (see
[https://docs.djangoproject.com/en/3.0/ref/models/fields/#enumeration-
types documentation] and
[https://github.com/django/django/blob/908c67e719a54b8b612cb7df732126f42350f3fa/tests/model_enums/tests.py#L153-L229
examples]), so described usage is not supported. In your case you can use
`IntegerChoices`.
--
Ticket URL: <https://code.djangoproject.com/ticket/31057#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates/070.0ffd63a59373dc3cdda2b367a6259ae1%40djangoproject.com.