TrangPham / django-admin-confirm

AdminConfirmMixin is a mixin for ModelAdmin that adds confirmations to changes, additions and actions.
Other
128 stars 16 forks source link

Filters are not preserved after saving with confirmation #49

Open CelestialStreamer opened 1 year ago

CelestialStreamer commented 1 year ago

Describe the bug After saving and confirming your actions, any filters which were present are not preserved. Normally in Django admin, if you use a filter (which adds something like ?foo=bar in the url), saving the model puts you back to the list view but remembers any filters you had previously used.

To Reproduce Steps to reproduce the behavior:

  1. Got to listview in admin of any model which is using NesteModelAdmin.
  2. Filter results. Note how your url has something like /admin/app/model/?foo=bar.
  3. Click to edit model.
  4. Edit model in any matter which will trigger the confirmation page django-admin-confirm features.
  5. Confirm
  6. Note how you are back to the list page but your filters are reset. Specifically note that the url's query parameters are all gone.

Expected behavior After confirming (step 5), I expect the filters to be preserved. In this case I'd expect the url to be back to /admin/app/model/?foo=bar.

Versions:

Additional context Django has supported preserving filters on the list view since 1.6

ModelAdmin now preserves filters on the list view after creating, editing or deleting an object. -- https://docs.djangoproject.com/en/dev/releases/1.6/