joashivanmoodley / django-pagination

Automatically exported from code.google.com/p/django-pagination
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

autopaginate tag makes queryset not lazy with django.views.generic.list_detail.object_list #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I use object_list view with dict like:
posts_dict={
        'queryset': Post.objects.all(),
        'template_name': 'galgather/posts_archive.html',
        'allow_empty':True,
        'template_object_name':'posts',
        }

In my template I use:
{% autopaginate posts_list 20 %}
{% pagination %}

Request for every page triggers query which fetches all instances of my 
post model every time instead of expected 20 of them - in SQL there's no 
LIMIT and OFFSET statements.

While I was testing django builtin Pagination object as described at
http://docs.djangoproject.com/en/dev/topics/pagination/#topics-pagination
it works well - queries include LIMIT and OFFSET

I use:
postgresql-8.3.5
django-1.0.2
django-pagination revision 46

Some more detailed information about my model is at
http://groups.google.com/group/django-users/browse_thread/
thread/8245495741aa34e5#

Original issue reported on code.google.com by gro...@sq9mev.info on 5 Feb 2009 at 7:49

GoogleCodeExporter commented 8 years ago
I cannot reproduce this issue.  I suspect you're doing {% if posts_list %} or 
something similar before calling 
autopaginate.  Also, you shouldn't have to use autopaginate in conjunction with 
generic views.  Generic views do 
the pagination for you already, so you should only have to call the paginate 
tag.

Original comment by flo...@gmail.com on 5 Feb 2009 at 7:57