starlette-admin icon indicating copy to clipboard operation
starlette-admin copied to clipboard

Auto-prefill form fields from SQLAlchemy model defaults

Open LoveBloodAndDiamonds opened this issue 9 months ago • 1 comments

Is your feature request related to a problem? Please describe.

Currently, when creating a new record via Starlette Admin, all form fields are empty by default, even if the SQLAlchemy model defines default values (either through default= or server_default=). This means users have to manually fill in values that should already have sensible defaults.

Describe the solution you’d like

I would like Starlette Admin to automatically prefill form fields with the default values defined in the SQLAlchemy model. For example, when a user clicks “Create” for a model, the form should already display those default values, similar to how sqladmin handles this.

Describe alternatives you’ve considered

Manually overriding form fields and setting initial values in a custom view.

Image

LoveBloodAndDiamonds avatar Jul 23 '25 07:07 LoveBloodAndDiamonds

#503

jowilf avatar Aug 18 '25 20:08 jowilf