-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Don't close related modal if error exists #257
Comments
@ArkieCoder nice catch... I never faced it personally. I think the best thing to do here would be display the errors in the modal without closing it automatically. |
Agreed. Does django-admin-interface support not closing the modal in the event of error messages? Or is this something that will require changes to be made to the module? I would be happy to work on a solution and submit a PR if needed. |
@ArkieCoder the modal closing is intercepted here: |
I took an extended look at this issue. Unfortunately simply blocking the close in Javascript brings no joy, because the code still redirects to |
Ok I have a solution - I added a
This provides the desired behavior - normal behavior on success, and display of the error message when there is one. Perhaps this can be of help to others. |
@ArkieCoder thank you for sharing your solution! Maybe this should be included in the package, I keep the issue open. |
Hello,
I am overriding
save_model
in aModelAdmin
class that is related to another class. In mysave_model
I am detecting if there were errors in the save process, which can happen if a user provides a malformed file to one of the fields. If there is an error, I usedjango.contrib.messages
to display the error to the user.The problem with using the related modal for this in my app is that the modal closes and the error message does not display. Is there a way to either 1) prevent the modal from closing if there is a message to display or 2) to force the parent page to reload if there are messages in the queue to display?
Thanks - this is a great module that radically improved the UX of my app with just a few small changes. Very much appreciated.
The text was updated successfully, but these errors were encountered: