Opened 7 years ago

Last modified 11 months ago

#29640 new Cleanup/optimization

Document (deprecate?) Paginator._get_page

Reported by: Josh Schneier Owned by: nobody
Component: Core (Other) Version: 2.1
Severity: Normal Keywords:
Cc: Ülgen Sarıkavak Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:How to create a pull request

Description

This has been undocumented since it was introduced in ~1.6 although it is meant for public use to override the Page class used by a Paginator.

Assuming we keep it (is anyone using it?) I think I like something along the approach of the generic views. We could add a get_page_class method and a page_class attribute although I wonder if the latter isn't enough. We'd need the former to maintain feature parity.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (4)

comment:1 by Josh Schneier, 7 years ago

Component: UncategorizedCore (Other)
Type: UncategorizedCleanup/optimization

comment:2 by Carlton Gibson, 7 years ago

Triage Stage: UnreviewedAccepted

Moving to get_page_class() plus page_class seems reasonable.

  • I know it's not public but maybe we should deprecate _get_page(), since it's been around a while. (Tim?)
  • If so, there's a slight wiggle: _get_page() returns the instance where get_page_class() would presumably give us the class, which we then instantiate in page().

Not sure whether just having the attribute would be enough? Maybe someone is customising for first or last page, as one thought. We may as well leave it available (rather than needing to re-add it later.)

comment:3 by Josh Schneier, 7 years ago

I regret suggesting get_page for the piece where we inlined the docs now. Maybe something like get_safe_page would have been better. That is a minor issue, I do wonder if that particular aspect of the functionality is used.

comment:4 by Ülgen Sarıkavak, 11 months ago

Cc: Ülgen Sarıkavak added
Note: See TracTickets for help on using tickets.
Back to Top