Skip to content
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

History view pagination #1277

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

jurrian
Copy link
Contributor

@jurrian jurrian commented Nov 9, 2023

Description

This will add pagination and filtering to the simple history admin view. This is needed because it will allow more performance views on instances with many historical records. Currently it is very likely to timeout depending on the settings.

It uses the same pagination as the default in Django.

Related Issue

This PR replaces this stale PR: #1220
Most of the text of this PR is copied from the stale one.

Closes #1117 and closes #1219.

Motivation and Context

This is needed because it will allow more performance views on instances with many historical records. Currently it is very likely to timeout depending on the settings .

How Has This Been Tested?

Added a few extra tests on top of what already existed in the stale PR.

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run the pre-commit run command to format and lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have added my name and/or github handle to AUTHORS.rst
  • I have added my change to CHANGES.rst
  • All new and existing tests passed.

@jurrian jurrian mentioned this pull request Nov 9, 2023
11 tasks
@jurrian
Copy link
Contributor Author

jurrian commented Nov 9, 2023

@ddabble @RumitAP I've created a new PR based on #1220 with some additional changes.

@jurrian
Copy link
Contributor Author

jurrian commented Jan 3, 2024

@ddabble could you have a look at this? It's basically the same as #1220 that you reviewed, with a small addition to make it work.

@diogosilva30
Copy link

Any update on this? Do you need any help?

@jurrian
Copy link
Contributor Author

jurrian commented Mar 15, 2024

@ddabble ?

@ddabble
Copy link
Member

ddabble commented Mar 15, 2024

@jurrian Sorry for the (very) late reply; I'm busy with some of the other PRs, currently, but this is definitely on my TODO list 🙂

@ferran-gutierrez
Copy link

Hi guys!

How is going this feature? I'm super engaged with that, for us would be an amazing deliveryHi guys!

How is going this feature? I'm super engaged with that for us will be an amazing delivery

@jurrian
Copy link
Contributor Author

jurrian commented Jul 17, 2024

Only needs review at the moment. Code should be complete, but needs to be tested and merged.

tim-schilling
tim-schilling previously approved these changes Nov 19, 2024
Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. It seems like it's a bit old now and needs to be rebased on main. Is that something you may have time for yet?

@jurrian jurrian force-pushed the pagination-and-filtering branch 3 times, most recently from 41a24bd to 78e10ce Compare November 25, 2024 13:01
@jurrian
Copy link
Contributor Author

jurrian commented Nov 25, 2024

@tim-schilling I have done the rebase and did some minor tweaks. Most notably historical_records is now page_obj to avoid confusion about the object. I tried to keep it in line with the Django docs and django/contrib/admin/templates/admin/object_history.html pagination html.

Borrowed from Django's object_history.html
@jurrian jurrian force-pushed the pagination-and-filtering branch from 78e10ce to 2b45e85 Compare November 25, 2024 13:07
@jurrian jurrian changed the title Pagination and filtering (new PR) History view pagination Nov 25, 2024
This avoids performing any database queries before we know that the user should be able to view data.
A developer is more likely to look for the term page size.
Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Thank you @jurrian!

@tim-schilling tim-schilling merged commit 5dfeefe into jazzband:master Nov 25, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Pagination and Filtering No pagination in admin list (a long history fails or super slow to load)
5 participants