This is in my urls.py:
group_info = {
'queryset': Group.objects.all(),
'template_object_name': 'groups',
'paginate_by': 25,
}
And this is the relevant URL:
(r’^groups/$’, ‘django.views.generic.list_detail.object_list’, group_info),
And this is my code in the template:
<div class="pagination">
<span class="step-links">
{% if groups.has_previous %}
<a href="?page={{ groups.previous_page_number }}">previous</a>
{% endif %}
<span class="current">
Page {{ groups.number }} of {{ groups.paginator.num_pages }}.
</span>
{% if groups.has_next %}
<a href="?page={{ groups.next_page_number }}">next</a>
{% endif %}
</span>
</div>
.. but no pagination information is displayed. I think I am doing this exactly as done in the documentation. Any idea what is wrong?
Thanks.
You’re using the wrong variable names. As the docs say, the variable names are
paginatorfor the paginator object andpage_objfor the page.