Allowing null column values when creating / editing records #319
andrewmackie
started this conversation in
Ideas
Replies: 1 comment
-
You are right, the checkbox is a regression was it was changed recently. Thanks for the explanations, I will create two separate tickets for these and they should be easy to fix:
Thanks for the suggestions and feel free to fix them. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When creating records, SQLAdmin displays a checkbox for boolean fields, resulting in default false value. Boolean fields, however, are actually tri-state - true, false and null. I suggest that booleans should instead be handled with a select tag that has (o) null ( ) false ( ) true as the options.
The same applies to text fields. Leaving a text field empty in the admin page creates an empty string in the column, but it's almost always preferable to leave the column as null (making it clear that a user/admin has not entered any text). I suggest a similar approach for text fields - a select tag with (o) null ( ) '' ( ) [text field] as the options (and if they click on the text field and enter nothing it should be treated as an empty string).
All of the above assumes that the column in question is nullable. Even when it is not, however, I think the same pattern should be applied with the null option disabled (grayed out) to show that null is not available because of the SQLALchemy model, not because of a bug or setting in SQLAdmin. You could also have a tooltip text when hovering over the disabled null option to explain that the column is not nullable in the model.
Thanks for the repo.
Beta Was this translation helpful? Give feedback.
All reactions