Opened 9 years ago
Closed 8 years ago
#26543 closed Bug (fixed)
Changelist actions don't redirect after failed action resulting in possible ERR_CACHE_MISS in next steps
Reported by: | Emmanuelle Delescolle | Owned by: | Adonys Alea Boffill |
---|---|---|---|
Component: | contrib.admin | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | emma@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
When a changlist action fail (at least when failing because no item was selected) no redirect is triggered.
Therefore if the user hits the browser "reload" button, he is asked to confirm that he wants to re-submit the form.
This looks inconsistent where the rest of Django Admin that usually always makes sure the user can hit the refresh button when on a list.
Another use-case where this lead to a more cryptic error message is this one:
- In a changelist select "Delete selected records" and click go
- A warning is displayed telling you to select items
- select any number of records
- pick "Delete selected records" and click go again
- On the confirmation page, click "No, take me back"
- Browser shows an ERR_CACHE_MISS error
Possible fixes I see:
- update the changelist code to redirect to the same changelist if an error occurs during the execution of a changelist action (fixes both use-cases)
- update the delete confirmation page to not use the browser history to go back (fixes only problem 2 but might also have some undesired side-effects like loss of selection)
Attachments (1)
Change History (11)
comment:1 by , 9 years ago
Cc: | added |
---|
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 8 years ago
Attachment: | #26543.diff added |
---|
comment:4 by , 8 years ago
Has patch: | set |
---|
This problem occurs every time that Django admin return again to the page after a failed POST
. In other words, every time that the validation of ActionForm
is failed. To solve this situation I added the current validations to the JavaScript
level, and the rest works fine.
comment:5 by , 8 years ago
Needs tests: | set |
---|
Thanks for the patch. I haven't taken a close look but a selenium test would also be required. To ease comment on the patch, please send a pull request rather than attaching a patch to ticket. One thing I noticed from a quick glance is that I'm not sure if moving <ul class="messagelist">
outside {% if messages %}
is acceptable since that could create an empty <ul>
which isn't valid HTML.
comment:6 by , 8 years ago
Needs tests: | unset |
---|
I added the Selenium
tests and follow the suggestion of <ul class="messagelist">
. This is the pull request https://github.com/django/django/pull/7645 .
comment:7 by , 8 years ago
Has patch: | unset |
---|
As discussed on the pull request, the redirect solution seems fine to me. We prefer writing Python over JavaScript, and I don't think the admin needs to be super slick about this case.
comment:8 by , 8 years ago
Thanks for the comment and I'm agree , today I'll make the new pull request with the redirect solution using only python code modification.
comment:9 by , 8 years ago
Has patch: | set |
---|
I added the new pull request with the new solution. To solve this ticket in the new pull request, a redirect will be made every time that Changelist action fail by ActionForm's validation error. This is the reference to the pull request ... https://github.com/django/django/pull/7726
Fixed changelist actions don't redirect after failed action