Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#2576 closed enhancement (wontfix)

[patch] PaginatorPage object

Reported by: SmileyChris Owned by: adrian
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

class PaginatorPage:
    """
    This class is used to work with a page of a paginator object.
    Pass a paginator object, and a valid page number.
    It uses the same methods as a paginator, except you do not need
    to use a page number.
    """

So it's just a page aware paginator object wrapper.

For example, if you have a paginator object in a view, you can set up a PaginatorPage object (passing the paginator and current page number) and then pass this object directly to your template.

  • It can work in a different base (base-1 is nice to work with at a template level)
  • It can return the next / previous page number

Attachments (1)

paginatorpage.py (2.2 KB) - added by SmileyChris 9 years ago.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by SmileyChris

comment:1 Changed 9 years ago by SmileyChris

I'm thinking perhaps it should default to base 1 too.

i.e. PaginatorPage(paginator, 0, base=1) instead of the current base=0 default

comment:2 Changed 9 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

Neat class, but a little too obscure for inclusion in Django. File it away in your bag of tricks, though :)

comment:3 Changed 7 years ago by adrian

Note that this was implemented in [7306].

Note: See TracTickets for help on using tickets.
Back to Top