shinneider / django-admin-inline-paginator

MIT License
128 stars 21 forks source link

Fix pagination keys in preserved filters querystring #26

Open qdelcourte opened 1 year ago

qdelcourte commented 1 year ago

Hi!

May fix this issue #20

Problem

Changes from the 2nd page onwards are not saved.

Solution

It appears that model change form doesn't contain the action url with pagination key. So when we click on save then Django lose the pagination context and save the wrong formset (default is for page 1).

Inline pagination needs context on each requests: https://github.com/shinneider/django-admin-inline-paginator/blob/53bf9162dfc724386f03dc3ecdcddbb1e3d07b70/django_admin_inline_paginator/admin.py#L31-L37

Django preserves only _changelist_filters : https://github.com/django/django/blob/f6f0699d01f5840437bfd236c76c797943ef8edc/django/contrib/admin/options.py#L1039-L1055

Discussions