Ticket #4619: 4619.2.patch

File 4619.2.patch, 2.7 KB (added by Collin Grady <cgrady@…>, 17 years ago)

woops, forgot docs on the last patch

  • django/views/generic/date_based.py

     
    88def archive_index(request, queryset, date_field, num_latest=15,
    99        template_name=None, template_loader=loader,
    1010        extra_context=None, allow_empty=False, context_processors=None,
    11         mimetype=None, allow_future=False):
     11        template_object_name='object', mimetype=None, allow_future=False):
    1212    """
    1313    Generic top-level archive of date-based objects.
    1414
     
    3737    t = template_loader.get_template(template_name)
    3838    c = RequestContext(request, {
    3939        'date_list' : date_list,
    40         'latest' : latest,
     40        '%s_list' % template_object_name : latest,
    4141    }, context_processors)
    4242    for key, value in extra_context.items():
    4343        if callable(value):
  • docs/generic_views.txt

     
    193193    * ``context_processors``: A list of template-context processors to apply to
    194194      the view's template. See the `RequestContext docs`_.
    195195
     196    * ``template_object_name``:  Designates the name of the template variable
     197      to use in the template context. By default, this is ``'object'``. The
     198      view will append ``'_list'`` to the value of this parameter in
     199      determining the variable's name.
     200
    196201    * ``mimetype``: The MIME type to use for the resulting document. Defaults
    197202      to the value of the ``DEFAULT_CONTENT_TYPE`` setting.
    198203
     
    221226      years that have objects available according to ``queryset``. These are
    222227      ordered in reverse. This is equivalent to
    223228      ``queryset.dates(date_field, 'year')[::-1]``.
    224     * ``latest``: The ``num_latest`` objects in the system, ordered descending
    225       by ``date_field``. For example, if ``num_latest`` is ``10``, then
    226       ``latest`` will be a list of the latest 10 objects in ``queryset``.
    227229
     230    * ``object_list``: The ``num_latest`` objects in the system, ordered
     231      descending by ``date_field``. For example, if ``num_latest`` is ``10``,
     232      then ``object_list`` will be a list of the latest 10 objects in
     233      ``queryset``. This variable's name depends on the
     234      ``template_object_name`` parameter, which is ``'object'`` by default. If
     235      ``template_object_name`` is ``'foo'``, this variable's name will be
     236      ``foo_list``.
     237
    228238.. _RequestContext docs: ../templates_python/#subclassing-context-requestcontext
    229239
    230240``django.views.generic.date_based.archive_year``
Back to Top