Replace custom templatetag with Django querystring in default templates #1023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a Proof-of-Concept for replacing the custom
querystring_replacetemplatetag with the built-in Djangoquerystring.Most of the changes are in a new
TablePaginatorMixinwhich brings table-awareness to the default Paginator and LazyPaginator, mainly so that its methods can access theprefixed_page_fieldvalue.Since most of the necessary data is now in the paginator, it made sense to try moving
table_page_rangethere (a different question is if we should leave the existing templatetag filter for compatibility).To correctly access the query params for each page,
paginator.table_page_rangenow returns a list of PageNumber instances. I recognize that the PageNumber implementation is a bit hacky, which kept the template changes minimal, but we can always revise it to return a list ofPageInfodataclasses or something else as an alternative.Tests are not passing currently because I wanted to validate some of the ideas first.