Search code examples
pythondjangopaginationdjango-pagination

Django: How to return a user to correct pagination page after editing or updating?


I am editing a content from table which has pagination in it. If i update a user which is at the page no 9 and save that user, it will return me to page no 1.

I want it to return to a same page where user was previously there that is at page no 9.

Any help regarding the same would be appreciated!


Solution

  • You need to pass to the editing page the page number you were on, in a query parameter. And keep track of it and when editing/updating is successful you redirect back to that page number.

    In your form include a next field. Where to redirect in case of success.