I'm trying to use Enums on Python 3.5 in my Django model. Why am I getting this when trying to migrate?
field=models.CharField(choices=[('RE', 'Red'), ('GR', 'Green'), ('BL', 'Blue'), ('OR', 'Orange'), ('YE', 'Yellow'), ('PU', 'Purple')], default=users.models.COLOR('BL'), max_length=2),
AttributeError: module 'users.models' has no attribute 'COLOR'
-
class User(AbstractBaseUser):
class COLOR(enum.Enum):
RED = 'RE'
GREEN = 'GR'
BLUE = 'BL'
ORANGE = 'OR'
YELLOW = 'YE'
PURPLE = 'PU'
//...
color = models.CharField(max_length=2, choices=((x.value, x.name.title()) for x in COLOR), default=COLOR.BLUE)
COLOR.BLUEis, even if you specified it correctly.