#14873: A paginated ListView with a List instead of queryset produces an error
------------------------------------+---------------------------------------
          Reporter:  andornaut      |         Owner:  nobody   
            Status:  new            |     Milestone:  1.3      
         Component:  Generic views  |       Version:  1.3-alpha
        Resolution:                 |      Keywords:           
             Stage:  Unreviewed     |     Has_patch:  0        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by andornaut):

 Another (and preferable, IMO) suggested fix:

 In django.views.generic.list.!MultipleObjectMixin.paginate_queryset!#35

 Replace this:
 {{{
 #!python
 if queryset.count() > page_size:
 }}}
 With this:
 {{{
 #!python
 if hasattr(self, 'paginate_by') and self.paginate_by:
 }}}

 Currently, the pagination-related context variables `page_obj` and
 `paginator` (line 91 of the same module) are only included if the number
 of pages is greater than 1. This requires that the template author handle
 this case in templates that use page_obj.has_next and other variables.
 Previously (IIRC), in Django 1.2's function-based generic views, the
 template author could count on those variables always being present, and
 so s/he didn't have to handle the special case where there is only 1 page.
 I believe that it would be preferable for  `paginator` and `page_obj` to
 be present if the user specifies that they want to use a pagination by
 setting `paginate_by`. This also, coincidentally, resolves the issue
 mentioned in this ticket.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14873#comment:2>
Django <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