Ticket #4619: 4619.2.patch
File 4619.2.patch, 2.7 KB (added by , 17 years ago) |
---|
-
django/views/generic/date_based.py
8 8 def archive_index(request, queryset, date_field, num_latest=15, 9 9 template_name=None, template_loader=loader, 10 10 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): 12 12 """ 13 13 Generic top-level archive of date-based objects. 14 14 … … 37 37 t = template_loader.get_template(template_name) 38 38 c = RequestContext(request, { 39 39 'date_list' : date_list, 40 ' latest': latest,40 '%s_list' % template_object_name : latest, 41 41 }, context_processors) 42 42 for key, value in extra_context.items(): 43 43 if callable(value): -
docs/generic_views.txt
193 193 * ``context_processors``: A list of template-context processors to apply to 194 194 the view's template. See the `RequestContext docs`_. 195 195 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 196 201 * ``mimetype``: The MIME type to use for the resulting document. Defaults 197 202 to the value of the ``DEFAULT_CONTENT_TYPE`` setting. 198 203 … … 221 226 years that have objects available according to ``queryset``. These are 222 227 ordered in reverse. This is equivalent to 223 228 ``queryset.dates(date_field, 'year')[::-1]``. 224 * ``latest``: The ``num_latest`` objects in the system, ordered descending225 by ``date_field``. For example, if ``num_latest`` is ``10``, then226 ``latest`` will be a list of the latest 10 objects in ``queryset``.227 229 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 228 238 .. _RequestContext docs: ../templates_python/#subclassing-context-requestcontext 229 239 230 240 ``django.views.generic.date_based.archive_year``