Currently ListView.paginate_queryset discriminates whether the resulting 
queryset is paginated or not in order to return a page_obj into the context 
(http://code.djangoproject.com/browser/django/trunk/django/views/generic/list.py?rev=14864#L51).
If there is only one page, 'page_obj' is set to None and 'object_list' 
contains the complete queryset, else return the current page as 'page_obj' 
and the complete qs under 'object_list'

This seems like a bug because now in the template you always have to ask 
whether the result is paginated and use either page_obj or object_list to 
iterate

{% if is_paginated %}
{% for item in page_obj.object_list %}
do stuff with {{item}}
{% endfor %}
{% else %}
{% for item in object_list %}
do stuff with {{item}}
{% endfor %}
{% endif %}

This functionality was introduced in 
http://code.djangoproject.com/ticket/14873. I think it's an unexpected 
behaviour or am I missing something?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to