-
Notifications
You must be signed in to change notification settings - Fork 53
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
DOC: how to properly handle ADD of entity with conflicting primary key (email) #543
Comments
You can also catch the Exception. e.g: starlette-admin/examples/sqla/views.py Line 66 in 7465db9
|
Somewhat related: #451 I think before_edit and before_create checks feels good. I believe you could also implement a custom field for each unique columns and field types and use it instead. |
Is your feature request related to a problem? Please describe.
I would like to see in the documentation the guidelines to deal with data entry. In my case, I am trying to add a USER object to the database, where the email is the primary key, and I am getting a "500/exception" because SQLAlchemy is properly flagging the invalid new record because these is already a USER with the same email (primary key).
Describe the solution you'd like
Just some example or doc that explains how to deal with data entry, including SAVE errors. It could be a NEW entity or an UPDATE (say, I change the guy's email).
Describe alternatives you've considered
I know there's the #before_create and #before_edit methods which I already use for some data validation. Should I do it in here? In the #before_create? Do a database query in #before_create and check?
Additional context
None
The text was updated successfully, but these errors were encountered: