define a required field with no defaultSee original GitHub issue
The code automatically sets the first choice as the default value: https://github.com/5monkeys/django-enumfield/blob/master/django_enumfield/db/fields.py#L16-L17
I think this behavior is misleading because if someone defines a field with no default, he expects the field to have no default assigned so that an error is raised if the field is also required.
Right now, it’s impossible to have a required field (
null=False) with no default that would work as expected in the admin.
enum.EnumField(STATUSES, blank=True, null=False)
default=None obviously doesn’t work as the whole code assumes there is a value.
- Created 7 years ago
- Comments:9 (3 by maintainers)