Opened 18 years ago

Closed 17 years ago

Last modified 16 years ago

#2576 closed enhancement (wontfix)

[patch] PaginatorPage object

Reported by: Chris Beaven Owned by: Adrian Holovaty
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: no UI/UX: no

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 Chris Beaven 18 years ago.

Download all attachments as: .zip

Change History (4)

by Chris Beaven, 18 years ago

Attachment: paginatorpage.py added

comment:1 by Chris Beaven, 18 years ago

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 by Jacob, 17 years ago

Resolution: wontfix
Status: newclosed

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

comment:3 by Adrian Holovaty, 16 years ago

Note that this was implemented in [7306].

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