Documented migration path for change object_list -> ListView regarding different context variables
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ece3a7c3c7
commit
d4c6abcbd1
|
@ -71,10 +71,10 @@ def object_list(request, queryset, paginate_by=None, page=None,
|
||||||
'%s_list' % template_object_name: page_obj.object_list,
|
'%s_list' % template_object_name: page_obj.object_list,
|
||||||
'paginator': paginator,
|
'paginator': paginator,
|
||||||
'page_obj': page_obj,
|
'page_obj': page_obj,
|
||||||
|
'is_paginated': page_obj.has_other_pages(),
|
||||||
|
|
||||||
# Legacy template context stuff. New templates should use page_obj
|
# Legacy template context stuff. New templates should use page_obj
|
||||||
# to access this instead.
|
# to access this instead.
|
||||||
'is_paginated': page_obj.has_other_pages(),
|
|
||||||
'results_per_page': paginator.per_page,
|
'results_per_page': paginator.per_page,
|
||||||
'has_next': page_obj.has_next(),
|
'has_next': page_obj.has_next(),
|
||||||
'has_previous': page_obj.has_previous(),
|
'has_previous': page_obj.has_previous(),
|
||||||
|
|
|
@ -74,6 +74,26 @@ was appended with the suffix ``'_list'`` to yield the final context
|
||||||
variable name. In a class-based ``ListView``, the
|
variable name. In a class-based ``ListView``, the
|
||||||
``context_object_name`` is used verbatim.
|
``context_object_name`` is used verbatim.
|
||||||
|
|
||||||
|
The context data for ``object_list`` views
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
The context provided by :class:`~django.views.generic.list.MultipleObjectMixin`
|
||||||
|
is quite different from that provided by ``object_list``, with most pagination
|
||||||
|
related variables replaced by a single ``page_obj`` object. The following are no
|
||||||
|
longer provided:
|
||||||
|
|
||||||
|
* ``first_on_page``
|
||||||
|
* ``has_next``
|
||||||
|
* ``has_previous``
|
||||||
|
* ``hits``
|
||||||
|
* ``last_on_page``
|
||||||
|
* ``next``
|
||||||
|
* ``page_range``
|
||||||
|
* ``page``
|
||||||
|
* ``pages``
|
||||||
|
* ``previous``
|
||||||
|
* ``results_per_page``
|
||||||
|
|
||||||
``extra_context``
|
``extra_context``
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue