#22731: page number variable update in docs for paginator
--------------------------------------+-----------------------
     Reporter:  joeyliechty@…         |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Documentation         |    Version:  1.6
     Severity:  Normal                |   Keywords:  paginator
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+-----------------------
 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
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22731>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.941ce40a782485023831247cc730cd76%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to