-
Notifications
You must be signed in to change notification settings - Fork 6
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
Form creation from a Mito model? #14
Comments
I suggest you have a look at Something like:
Where |
Just my 2 cents. |
thanks I'll have a better look from this. FWIW, I have a better idea now, here's my notes and a poc that gives me a simple form (but with no relational columns, no form validation, a global message for error reporting). https://github.com/OpenBookStore/openbookstore/blob/master/src/web/mito-admin/mito-forms.lisp @mdbergmann yeah in my scenario defining such a form is optional and comes after and independently of the DB model. I wouldn't rely exclusively on such a CRUD dashboard either, I would create the most important forms from scratch, but having automatic forms is nice to have with DB models that are less important but that the user needs to edit from time to time. |
My suggestion is to use a generic-function for view creation. Default implementation returns the reified form from the mito model. Specialize the generic function on the type of object for a custom view. That's what I use in https://codeberg.org/mmontone/mold-desktop . |
cl-forms allows to create a form from a model class: https://mmontone.github.io/cl-forms/#Models
where one has to give all the fields, as well as their input type
I wish we could infer those from a Mito model and create a form with shorter code.
Example:
I found a couple introspection functions:
Ideally we would create a form with all the fields and right types by default and we could exclude some fields (title-ascii).
This would bring us closer to a CRUD admin dashboard… (I got how to list tables and records, adding and editing a record generically is a non-obvious next step).
Any feedback is welcome!
The text was updated successfully, but these errors were encountered: