diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-09-14 03:54:28 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-09-14 03:54:28 +0000 |
| commit | 2bec822ff345ed68047d618f707bb2765fad7e5f (patch) | |
| tree | 4bf1073f91286b99e376108711d9e16635a24e24 /docs | |
| parent | 70e5dce3651de6f5494233802a5de609182045df (diff) | |
Fixed #3895 -- Added ability to customize the context variable in the archive_index generic view. Thanks to marco.giusti@gmail.com and toke-django@toke.de.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6157 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/generic_views.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/docs/generic_views.txt b/docs/generic_views.txt index 33c39b7e12..6671382b58 100644 --- a/docs/generic_views.txt +++ b/docs/generic_views.txt @@ -201,6 +201,9 @@ a date in the *future* are not included unless you set ``allow_future`` to specified in ``date_field`` is greater than the current date/time. By default, this is ``False``. + * ``template_object_name``: Designates the name of the template variable + to use in the template context. By default, this is ``'latest'``. + **Template name:** If ``template_name`` isn't specified, this view will use the template @@ -221,9 +224,13 @@ In addition to ``extra_context``, the template's context will be: years that have objects available according to ``queryset``. These are ordered in reverse. This is equivalent to ``queryset.dates(date_field, 'year')[::-1]``. + * ``latest``: The ``num_latest`` objects in the system, ordered descending by ``date_field``. For example, if ``num_latest`` is ``10``, then - ``latest`` will be a list of the latest 10 objects in ``queryset``. + ``latest`` will be a list of the latest 10 objects in ``queryset``. This + variable's name depends on the ``template_object_name`` parameter, which + is ``'latest'`` by default. If ``template_object_name`` is ``'foo'``, + this variable's name will be ``foo``. .. _RequestContext docs: ../templates_python/#subclassing-context-requestcontext |
