diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-06-03 22:06:48 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-06-03 22:06:48 +0000 |
| commit | fc2a02f9666a2cd610443fc2107560b9832a017a (patch) | |
| tree | 1bf56b9d0fcab25da4105a4e3f7c2872b0e6c107 /docs | |
| parent | 9b86db9bf2407f408468566b3f48a8444cb66f83 (diff) | |
Fixed #2075 -- Added 'page' parameter to object_list generic view. Thanks, kanashii@kanashii.ca
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3071 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/generic_views.txt | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/docs/generic_views.txt b/docs/generic_views.txt index 317828a2b2..d14fe12418 100644 --- a/docs/generic_views.txt +++ b/docs/generic_views.txt @@ -641,8 +641,10 @@ A page representing a list of objects. * ``paginate_by``: An integer specifying how many objects should be displayed per page. If this is given, the view will paginate objects with - ``paginate_by`` objects per page. The view will expect a ``page`` query - string (GET) parameter containing a zero-indexed page number. + ``paginate_by`` objects per page. The view will expect either a ``page`` + query string parameter (via ``GET``) containing a zero-indexed page + number, or a ``page`` variable specified in the URLconf. See + "Notes on pagination" below. * ``template_name``: The full name of a template to use in rendering the page. This lets you override the default template name (see below). @@ -711,6 +713,25 @@ If the results are paginated, the context will contain these extra variables: * ``hits``: The total number of objects across *all* pages, not just this page. +Notes on pagination +~~~~~~~~~~~~~~~~~~~ + +If ``paginate_by`` is specified, Django will paginate the results. You can +specify the page number in the URL in one of two ways: + + * Use the ``page`` parameter in the URLconf. For example, this is what + your URLconf might look like:: + + (r'^objects/page(?P<page>[0-9]+)/$', 'object_list', dict(info_dict)) + + * Pass the page number via the ``page`` query-string parameter. For + example, a URL would look like this: + + /objects/?page=3 + +In both cases, ``page`` is 1-based, not 0-based, so the first page would be +represented as page ``1``. + ``django.views.generic.list_detail.object_detail`` -------------------------------------------------- |
