You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'd like to add empty as choice on a nullable field, see: https://docs.djangoproject.com/en/5.1/ref/models/fields/#enumeration-types (at the bottom of the paragraph). However AssertionError: Invalid nullable case is then raised on scheme generation. I noticed this error is also raised when overriding the choices and adding a (None, 'unknown') tuple to the choices.
Describe the bug
I'd like to add empty as choice on a nullable field, see: https://docs.djangoproject.com/en/5.1/ref/models/fields/#enumeration-types (at the bottom of the paragraph). However
AssertionError: Invalid nullable case
is then raised on scheme generation. I noticed this error is also raised when overriding the choices and adding a (None, 'unknown') tuple to the choices.To Reproduce
Add
OR
to the choices
Expected behavior
I would expect the field to have null as a choice.
I have tried all other methods to make the (read_only) field nullable, but this seems impossible.
What have I tried:
Add allow_null=True, allow_blank=True, required=False, amongst others.
I do have
"ENUM_ADD_EXPLICIT_BLANK_NULL_CHOICE": False,
because otherwise I loose a lot of Enums (they become simply "string", not enum, in the scheme generation).
I have also noticed that upgrading to 0.28.0 also made me lose a lot of read-only Enums, so I'm still on 0.27.2.
The text was updated successfully, but these errors were encountered: