[Fixed]-AttributeError when using Enums (Python 3.5) in Django Model

1👍

Since you use a CharField on the model, you can not pass an enum instance (default=COLOR.BLUE) as the default value. You should pass a string instead.

The better way to do this is to define a custom field which knows how to clean enum instances. If you rather to keep things simple and stick to the CharField on the model, then just pass the enum value explicitly (default='BL').

👤wim

Leave a comment