# Moving to Django 3.0's Field.choices Enumeration Types

**URL:** <https://forum.djangoproject.com/t/moving-to-django-3-0s-field-choices-enumeration-types/970>\
**Category:** Show & Tell\
**Created:** [January 27, 2020, 2:45pm UTC](https://forum.djangoproject.com/t/moving-to-django-3-0s-field-choices-enumeration-types/970 "2020-01-27T14:45:58Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [February 3, 2020, 10:08pm UTC](https://forum.djangoproject.com/t/moving-to-django-3-0s-field-choices-enumeration-types/970/8 "2020-02-03T22:08:58Z")

</div>

Unfortunately the Meta class can’t refer to the names in the outer class being defined:

```auto
In [11]: class MyChoices(Enum):
    ...: WHATEVER = "1"
    ...: SOMETHING = "2"
    ...:
    ...: class Meta:
    ...: SOME_GROUP = {WHATEVER, SOMETHING}
    ...: GROUPING = [
    ...: ['Something', [WHATEVER, SOMETHING]]
    ...: ]
    ...:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-11-3fe4f79f24e8> in <module>
...
<ipython-input-11-3fe4f79f24e8> in Meta()
      4
      5 class Meta:
----> 6 SOME_GROUP = {WHATEVER, SOMETHING}
      7 GROUPING = [
      8 ['Something', [WHATEVER, SOMETHING]]

NameError: name 'WHATEVER' is not defined

```

We could use strings to refer to them (`SOME_GROUP = {'WHATEVER', 'SOMETHING'}`) or special names in the main class. Given that enums already use some special names, and it’s cleaner syntax, I am in favour of the latter.

---

_[View the full topic](https://forum.djangoproject.com/t/moving-to-django-3-0s-field-choices-enumeration-types/970)._
