Skip to content

define a required field with no default #25

@YAmikep

Description

@YAmikep

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)

Setting default=None obviously doesn't work as the whole code assumes there is a value.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions