Opened 12 years ago

Closed 12 years ago

#19165 closed New feature (invalid)

add first and last page to paginator

Reported by: ciro.santilli@… Owned by: nobody
Component: Core (Other) Version: 1.4
Severity: Normal Keywords: paginator, last page, first page
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Hi,

If it does not exist, add a first/last page method to the Page object returned by django.core.paginator import Paginator,
so that web pages can easily do first/last page links.

If it exists, add it to the docs at:

https://docs.djangoproject.com/en/dev/topics/pagination/#django.core.paginator.Page

Change History (3)

comment:1 by Łukasz Rekucki, 12 years ago

Triage Stage: UnreviewedDesign decision needed

Both the first and last page can be accessed easily through the paginator:

first_page = paginator.page(1)
last_page = paginator.page(paginator.num_pages)

IMHO, there is no need for anything like first_page_number as it's always 1 and page.last_page_number doesn't save much compared to page.paginator.num_pages. But maybe I'm missing something.

comment:2 by Ciro Duran Santilli <ciro.santilli@…>, 12 years ago

Aw, should have read better the tutorial, I hadn't seen that the Page object (which is what is usually passed to templates) has a Paginator field.

In this case, we can just write:

page.paginator.num_pages

for the last page.

So I agree adding more fields to the Page object would be a minor improvement.

This ticket can be closed on my part.

comment:3 by Claude Paroz, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top