#3391: [patch] django.views.generic.list_detail.object_list - add context
variables on pagination
-----------------------------------------------+----------------------------
   Reporter:  Max Derkachev <[EMAIL PROTECTED]>  |                Owner:  jacob 
                
     Status:  new                              |            Component:  Generic 
views         
    Version:  SVN                              |           Resolution:          
              
   Keywords:                                   |                Stage:  Design 
decision needed
  Has_patch:  1                                |           Needs_docs:  0       
              
Needs_tests:  0                                |   Needs_better_patch:  0       
              
-----------------------------------------------+----------------------------
Comment (by Max Derkachev <[EMAIL PROTECTED]>):

 Indeed, I missed the fact that ObjectPaginator has first_on_page and
 last_on_page methods.
 So, I updated the patch and added one property to ObjectPaginator to get
 the list of page numbers.
 I've also changed the names of variables to more meaningful.
 
 The subtle problem is that ObjectPaginator uses 0-based page number (the
 view uses 1-based), and one that uses it should always remember that when
 calling ObjectPaginator members.
 E.g. the constructor is called with page - 1 from the view.
 So, to get first_item, the view should call them as
 paginator.first_on_page(page - 1).
 But I guess that should not chnange since it may break BC, if somebody
 uses ObjectPaginator in custom views.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3391#comment:2>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to