Opened 4 years ago

Closed 4 years ago

#22731 closed Cleanup/optimization (wontfix)

page number variable update in docs for paginator

Reported by: joeyliechty@… Owned by: nobody
Component: Documentation Version: 1.6
Severity: Normal Keywords: paginator
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

https://docs.djangoproject.com/en/dev/topics/pagination/#using-paginator-in-a-view

In this chunk of the documentation, perhaps it would be beneficial to also update the page number variable.
Something like this:

page = request.GET.get('page')
try:
    contacts = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        contacts = paginator.page(1)
        page = 1
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        contacts = paginator.page(paginator.num_pages)
        page = paginator.num_pages

Change History (1)

comment:1 Changed 4 years ago by Tim Graham

Resolution: wontfix
Status: newclosed

Please reopen if I've missed something, but I don't see the point in updating the variable when it's not used in any code that follows.

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