-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: hook to populate UI with default values on entity creation #491
Comments
I think we need an attribute called I just checked the templates, and saw these lines... starlette-admin/starlette_admin/templates/create.html Lines 29 to 40 in 2540c51
The data that input fields take is calculated inside the template (see |
Yes, and read the default value from the column definition (SQLAlchemy), Field(mongoengine)... |
Yep, that's what I'm talking about. Do you have a work in progress about this? If not, I may try to implement some stuff (I missed your reviews 😂, they are teaching!). |
I'm glad you are learning from my reviews. Feel free to submit a PR for this. Thanks |
Is your feature request related to a problem? Please describe.
Currently the UI to add an entity does not populate it with default values.
#327 does not solve it. The UI still opens with blank values.
Describe the solution you'd like
I was expecting before_create from #327 to do this, but it seems to run AFTER the SAVE button is clicked. The UI is opened blank, still. Maybe we need another hook, before_ui_opens or something like that?
Describe alternatives you've considered
I have overriden before_create but it is only run AFTER. Same with before_edit
Additional context
In before_create I have put logic to honor SQLALchemy's default values:
Unfortunately it does not run soon enough to populate the UI when the user clicks "New "
The text was updated successfully, but these errors were encountered: