| 164 | | **Required arguments:** |
|---|
| 165 | | |
|---|
| 166 | | * ``queryset``: A ``QuerySet`` of objects for which the archive serves. |
|---|
| 167 | | |
|---|
| 168 | | * ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in |
|---|
| 169 | | the ``QuerySet``'s model that the date-based archive should use to |
|---|
| 170 | | determine the objects on the page. |
|---|
| 171 | | |
|---|
| 172 | | **Optional arguments:** |
|---|
| 173 | | |
|---|
| 174 | | * ``num_latest``: The number of latest objects to send to the template |
|---|
| 175 | | context. By default, it's 15. |
|---|
| 176 | | |
|---|
| 177 | | * ``template_name``: The full name of a template to use in rendering the |
|---|
| 178 | | page. This lets you override the default template name (see below). |
|---|
| 179 | | |
|---|
| 180 | | * ``template_loader``: The template loader to use when loading the |
|---|
| 181 | | template. By default, it's ``django.template.loader``. |
|---|
| 182 | | |
|---|
| 183 | | * ``extra_context``: A dictionary of values to add to the template |
|---|
| 184 | | context. By default, this is an empty dictionary. If a value in the |
|---|
| 185 | | dictionary is callable, the generic view will call it |
|---|
| 186 | | just before rendering the template. |
|---|
| 187 | | |
|---|
| 188 | | * ``allow_empty``: A boolean specifying whether to display the page if no |
|---|
| 189 | | objects are available. If this is ``False`` and no objects are available, |
|---|
| 190 | | the view will raise a 404 instead of displaying an empty page. By |
|---|
| 191 | | default, this is ``True``. |
|---|
| 192 | | |
|---|
| 193 | | * ``context_processors``: A list of template-context processors to apply to |
|---|
| 194 | | the view's template. See the `RequestContext docs`_. |
|---|
| 195 | | |
|---|
| 196 | | * ``mimetype``: The MIME type to use for the resulting document. Defaults |
|---|
| 197 | | to the value of the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| 198 | | |
|---|
| 199 | | * ``allow_future``: A boolean specifying whether to include "future" |
|---|
| 200 | | objects on this page, where "future" means objects in which the field |
|---|
| 201 | | specified in ``date_field`` is greater than the current date/time. By |
|---|
| 202 | | default, this is ``False``. |
|---|
| 203 | | |
|---|
| 204 | | * **New in Django development version:** ``template_object_name``: |
|---|
| 205 | | Designates the name of the template variable to use in the template |
|---|
| 206 | | context. By default, this is ``'latest'``. |
|---|
| 207 | | |
|---|
| 208 | | **Template name:** |
|---|
| | 173 | Required arguments |
|---|
| | 174 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 175 | |
|---|
| | 176 | ``queryset`` |
|---|
| | 177 | A ``QuerySet`` of objects for which the archive serves. |
|---|
| | 178 | |
|---|
| | 179 | ``date_field`` |
|---|
| | 180 | The name of the ``DateField`` or ``DateTimeField`` in the ``QuerySet``'s |
|---|
| | 181 | model that the date-based archive should use to determine the objects on |
|---|
| | 182 | the page. |
|---|
| | 183 | |
|---|
| | 184 | Optional arguments |
|---|
| | 185 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 186 | |
|---|
| | 187 | ``num_latest`` |
|---|
| | 188 | The number of latest objects to send to the template context. By default, |
|---|
| | 189 | it's 15. |
|---|
| | 190 | |
|---|
| | 191 | ``template_name`` |
|---|
| | 192 | The full name of a template to use in rendering the page. This lets you |
|---|
| | 193 | override the default template name (see below). |
|---|
| | 194 | |
|---|
| | 195 | ``template_loader`` |
|---|
| | 196 | The template loader to use when loading the template. By default, it's |
|---|
| | 197 | ``django.template.loader``. |
|---|
| | 198 | |
|---|
| | 199 | ``extra_context`` |
|---|
| | 200 | A dictionary of values to add to the template context. By default, this is |
|---|
| | 201 | an empty dictionary. If a value in the dictionary is callable, the generic |
|---|
| | 202 | view will call it just before rendering the template. |
|---|
| | 203 | |
|---|
| | 204 | ``allow_empty`` |
|---|
| | 205 | A boolean specifying whether to display the page if no objects are |
|---|
| | 206 | available. If this is ``False`` and no objects are available, the view will |
|---|
| | 207 | raise a 404 instead of displaying an empty page. By default, this is |
|---|
| | 208 | ``True``. |
|---|
| | 209 | |
|---|
| | 210 | ``context_processors`` |
|---|
| | 211 | A list of template-context processors to apply to the view's template. See |
|---|
| | 212 | the `RequestContext docs`_. |
|---|
| | 213 | |
|---|
| | 214 | ``mimetype`` |
|---|
| | 215 | The MIME type to use for the resulting document. Defaults to the value of |
|---|
| | 216 | the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| | 217 | |
|---|
| | 218 | ``allow_future`` |
|---|
| | 219 | A boolean specifying whether to include "future" objects on this page, |
|---|
| | 220 | where "future" means objects in which the field specified in ``date_field`` |
|---|
| | 221 | is greater than the current date/time. By default, this is ``False``. |
|---|
| | 222 | |
|---|
| | 223 | ``template_object_name`` (**New in Django development version**) |
|---|
| | 224 | Designates the name of the template variable to use in the template |
|---|
| | 225 | context. By default, this is ``'latest'``. |
|---|
| | 226 | |
|---|
| | 227 | Template name |
|---|
| | 228 | ~~~~~~~~~~~~~ |
|---|
| 224 | | * ``date_list``: A list of ``datetime.date`` objects representing all |
|---|
| 225 | | years that have objects available according to ``queryset``. These are |
|---|
| 226 | | ordered in reverse. This is equivalent to |
|---|
| 227 | | ``queryset.dates(date_field, 'year')[::-1]``. |
|---|
| 228 | | |
|---|
| 229 | | * ``latest``: The ``num_latest`` objects in the system, ordered descending |
|---|
| 230 | | by ``date_field``. For example, if ``num_latest`` is ``10``, then |
|---|
| 231 | | ``latest`` will be a list of the latest 10 objects in ``queryset``. |
|---|
| 232 | | |
|---|
| 233 | | **New in Django development version:** This variable's name depends on |
|---|
| 234 | | the ``template_object_name`` parameter, which is ``'latest'`` by default. |
|---|
| 235 | | If ``template_object_name`` is ``'foo'``, this variable's name will be |
|---|
| 236 | | ``foo``. |
|---|
| | 245 | ``date_list`` |
|---|
| | 246 | A list of ``datetime.date`` objects representing all years that have |
|---|
| | 247 | objects available according to ``queryset``. These are ordered in reverse. |
|---|
| | 248 | This is equivalent to ``queryset.dates(date_field, 'year')[::-1]``. |
|---|
| | 249 | |
|---|
| | 250 | ``latest`` |
|---|
| | 251 | The ``num_latest`` objects in the system, ordered descending by |
|---|
| | 252 | ``date_field``. For example, if ``num_latest`` is ``10``, then ``latest`` |
|---|
| | 253 | will be a list of the latest 10 objects in ``queryset``. |
|---|
| | 254 | |
|---|
| | 255 | **New in Django development version:** This variable's name depends on the |
|---|
| | 256 | ``template_object_name`` parameter, which is ``'latest'`` by default. |
|---|
| | 257 | If ``template_object_name`` is ``'foo'``, this variable's name will be |
|---|
| | 258 | ``foo``. |
|---|
| 249 | | **Required arguments:** |
|---|
| 250 | | |
|---|
| 251 | | * ``year``: The four-digit year for which the archive serves. |
|---|
| 252 | | |
|---|
| 253 | | * ``queryset``: A ``QuerySet`` of objects for which the archive serves. |
|---|
| 254 | | |
|---|
| 255 | | * ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in |
|---|
| 256 | | the ``QuerySet``'s model that the date-based archive should use to |
|---|
| 257 | | determine the objects on the page. |
|---|
| 258 | | |
|---|
| 259 | | **Optional arguments:** |
|---|
| 260 | | |
|---|
| 261 | | * ``template_name``: The full name of a template to use in rendering the |
|---|
| 262 | | page. This lets you override the default template name (see below). |
|---|
| 263 | | |
|---|
| 264 | | * ``template_loader``: The template loader to use when loading the |
|---|
| 265 | | template. By default, it's ``django.template.loader``. |
|---|
| 266 | | |
|---|
| 267 | | * ``extra_context``: A dictionary of values to add to the template |
|---|
| 268 | | context. By default, this is an empty dictionary. If a value in the |
|---|
| 269 | | dictionary is callable, the generic view will call it |
|---|
| 270 | | just before rendering the template. |
|---|
| 271 | | |
|---|
| 272 | | * ``allow_empty``: A boolean specifying whether to display the page if no |
|---|
| 273 | | objects are available. If this is ``False`` and no objects are available, |
|---|
| 274 | | the view will raise a 404 instead of displaying an empty page. By |
|---|
| 275 | | default, this is ``False``. |
|---|
| 276 | | |
|---|
| 277 | | * ``context_processors``: A list of template-context processors to apply to |
|---|
| 278 | | the view's template. See the `RequestContext docs`_. |
|---|
| 279 | | |
|---|
| 280 | | * ``template_object_name``: Designates the name of the template variable |
|---|
| 281 | | to use in the template context. By default, this is ``'object'``. The |
|---|
| 282 | | view will append ``'_list'`` to the value of this parameter in |
|---|
| 283 | | determining the variable's name. |
|---|
| 284 | | |
|---|
| 285 | | * ``make_object_list``: A boolean specifying whether to retrieve the full |
|---|
| 286 | | list of objects for this year and pass those to the template. If ``True``, |
|---|
| 287 | | this list of objects will be made available to the template as |
|---|
| 288 | | ``object_list``. (The name ``object_list`` may be different; see the docs |
|---|
| 289 | | for ``object_list`` in the "Template context" section below.) By default, |
|---|
| 290 | | this is ``False``. |
|---|
| 291 | | |
|---|
| 292 | | * ``mimetype``: The MIME type to use for the resulting document. Defaults |
|---|
| 293 | | to the value of the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| 294 | | |
|---|
| 295 | | * ``allow_future``: A boolean specifying whether to include "future" |
|---|
| 296 | | objects on this page, where "future" means objects in which the field |
|---|
| 297 | | specified in ``date_field`` is greater than the current date/time. By |
|---|
| 298 | | default, this is ``False``. |
|---|
| 299 | | |
|---|
| 300 | | **Template name:** |
|---|
| | 272 | Required arguments |
|---|
| | 273 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 274 | |
|---|
| | 275 | ``year`` |
|---|
| | 276 | The four-digit year for which the archive serves. |
|---|
| | 277 | |
|---|
| | 278 | ``queryset`` |
|---|
| | 279 | A ``QuerySet`` of objects for which the archive serves. |
|---|
| | 280 | |
|---|
| | 281 | ``date_field`` |
|---|
| | 282 | The name of the ``DateField`` or ``DateTimeField`` in the ``QuerySet``'s |
|---|
| | 283 | model that the date-based archive should use to determine the objects on |
|---|
| | 284 | the page. |
|---|
| | 285 | |
|---|
| | 286 | Optional arguments |
|---|
| | 287 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 288 | |
|---|
| | 289 | ``template_name`` |
|---|
| | 290 | The full name of a template to use in rendering the page. This lets you |
|---|
| | 291 | override the default template name (see below). |
|---|
| | 292 | |
|---|
| | 293 | ``template_loader`` |
|---|
| | 294 | The template loader to use when loading the template. By default, it's |
|---|
| | 295 | ``django.template.loader``. |
|---|
| | 296 | |
|---|
| | 297 | ``extra_context`` |
|---|
| | 298 | A dictionary of values to add to the template context. By default, this is |
|---|
| | 299 | an empty dictionary. If a value in the dictionary is callable, the generic |
|---|
| | 300 | view will call it just before rendering the template. |
|---|
| | 301 | |
|---|
| | 302 | ``allow_empty`` |
|---|
| | 303 | A boolean specifying whether to display the page if no objects are |
|---|
| | 304 | available. If this is ``False`` and no objects are available, the view will |
|---|
| | 305 | raise a 404 instead of displaying an empty page. By default, this is |
|---|
| | 306 | ``False``. |
|---|
| | 307 | |
|---|
| | 308 | ``context_processors`` |
|---|
| | 309 | A list of template-context processors to apply to the view's template. See |
|---|
| | 310 | the `RequestContext docs`_. |
|---|
| | 311 | |
|---|
| | 312 | ``template_object_name`` |
|---|
| | 313 | Designates the name of the template variable to use in the template |
|---|
| | 314 | context. By default, this is ``'object'``. The view will append ``'_list'`` |
|---|
| | 315 | to the value of this parameter in determining the variable's name. |
|---|
| | 316 | |
|---|
| | 317 | ``make_object_list`` |
|---|
| | 318 | A boolean specifying whether to retrieve the full list of objects for this |
|---|
| | 319 | year and pass those to the template. If ``True``, this list of objects will |
|---|
| | 320 | be made available to the template as ``object_list``. (The name |
|---|
| | 321 | ``object_list`` may be different; see the docs for ``object_list`` in the |
|---|
| | 322 | "Template context" section below.) By default, this is ``False``. |
|---|
| | 323 | |
|---|
| | 324 | ``mimetype`` |
|---|
| | 325 | The MIME type to use for the resulting document. Defaults to the value of |
|---|
| | 326 | the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| | 327 | |
|---|
| | 328 | ``allow_future`` |
|---|
| | 329 | A boolean specifying whether to include "future" objects on this page, |
|---|
| | 330 | where "future" means objects in which the field specified in ``date_field`` |
|---|
| | 331 | is greater than the current date/time. By default, this is ``False``. |
|---|
| | 332 | |
|---|
| | 333 | Template name |
|---|
| | 334 | ~~~~~~~~~~~~~ |
|---|
| 309 | | * ``date_list``: A list of ``datetime.date`` objects representing all |
|---|
| 310 | | months that have objects available in the given year, according to |
|---|
| 311 | | ``queryset``, in ascending order. |
|---|
| 312 | | |
|---|
| 313 | | * ``year``: The given year, as a four-character string. |
|---|
| 314 | | |
|---|
| 315 | | * ``object_list``: If the ``make_object_list`` parameter is ``True``, this |
|---|
| 316 | | will be set to a list of objects available for the given year, ordered by |
|---|
| 317 | | the date field. This variable's name depends on the |
|---|
| 318 | | ``template_object_name`` parameter, which is ``'object'`` by default. If |
|---|
| 319 | | ``template_object_name`` is ``'foo'``, this variable's name will be |
|---|
| 320 | | ``foo_list``. |
|---|
| 321 | | |
|---|
| 322 | | If ``make_object_list`` is ``False``, ``object_list`` will be passed to |
|---|
| 323 | | the template as an empty list. |
|---|
| | 344 | ``date_list`` |
|---|
| | 345 | A list of ``datetime.date`` objects representing all months that have |
|---|
| | 346 | objects available in the given year, according to ``queryset``, in |
|---|
| | 347 | ascending order. |
|---|
| | 348 | |
|---|
| | 349 | ``year`` |
|---|
| | 350 | The given year, as a four-character string. |
|---|
| | 351 | |
|---|
| | 352 | ``object_list`` |
|---|
| | 353 | If the ``make_object_list`` parameter is ``True``, this will be set to a |
|---|
| | 354 | list of objects available for the given year, ordered by the date field. |
|---|
| | 355 | This variable's name depends on the ``template_object_name`` parameter, |
|---|
| | 356 | which is ``'object'`` by default. If ``template_object_name`` is ``'foo'``, |
|---|
| | 357 | this variable's name will be ``foo_list``. |
|---|
| | 358 | |
|---|
| | 359 | If ``make_object_list`` is ``False``, ``object_list`` will be passed to the |
|---|
| | 360 | template as an empty list. |
|---|
| 334 | | **Required arguments:** |
|---|
| 335 | | |
|---|
| 336 | | * ``year``: The four-digit year for which the archive serves (a string). |
|---|
| 337 | | |
|---|
| 338 | | * ``month``: The month for which the archive serves, formatted according to |
|---|
| 339 | | the ``month_format`` argument. |
|---|
| 340 | | |
|---|
| 341 | | * ``queryset``: A ``QuerySet`` of objects for which the archive serves. |
|---|
| 342 | | |
|---|
| 343 | | * ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in |
|---|
| 344 | | the ``QuerySet``'s model that the date-based archive should use to |
|---|
| 345 | | determine the objects on the page. |
|---|
| 346 | | |
|---|
| 347 | | **Optional arguments:** |
|---|
| 348 | | |
|---|
| 349 | | * ``month_format``: A format string that regulates what format the |
|---|
| 350 | | ``month`` parameter uses. This should be in the syntax accepted by |
|---|
| 351 | | Python's ``time.strftime``. (See the `strftime docs`_.) It's set to |
|---|
| 352 | | ``"%b"`` by default, which is a three-letter month abbreviation. To |
|---|
| 353 | | change it to use numbers, use ``"%m"``. |
|---|
| 354 | | |
|---|
| 355 | | * ``template_name``: The full name of a template to use in rendering the |
|---|
| 356 | | page. This lets you override the default template name (see below). |
|---|
| 357 | | |
|---|
| 358 | | * ``template_loader``: The template loader to use when loading the |
|---|
| 359 | | template. By default, it's ``django.template.loader``. |
|---|
| 360 | | |
|---|
| 361 | | * ``extra_context``: A dictionary of values to add to the template |
|---|
| 362 | | context. By default, this is an empty dictionary. If a value in the |
|---|
| 363 | | dictionary is callable, the generic view will call it |
|---|
| 364 | | just before rendering the template. |
|---|
| 365 | | |
|---|
| 366 | | * ``allow_empty``: A boolean specifying whether to display the page if no |
|---|
| 367 | | objects are available. If this is ``False`` and no objects are available, |
|---|
| 368 | | the view will raise a 404 instead of displaying an empty page. By |
|---|
| 369 | | default, this is ``False``. |
|---|
| 370 | | |
|---|
| 371 | | * ``context_processors``: A list of template-context processors to apply to |
|---|
| 372 | | the view's template. See the `RequestContext docs`_. |
|---|
| 373 | | |
|---|
| 374 | | * ``template_object_name``: Designates the name of the template variable |
|---|
| 375 | | to use in the template context. By default, this is ``'object'``. The |
|---|
| 376 | | view will append ``'_list'`` to the value of this parameter in |
|---|
| 377 | | determining the variable's name. |
|---|
| 378 | | |
|---|
| 379 | | * ``mimetype``: The MIME type to use for the resulting document. Defaults |
|---|
| 380 | | to the value of the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| 381 | | |
|---|
| 382 | | * ``allow_future``: A boolean specifying whether to include "future" |
|---|
| 383 | | objects on this page, where "future" means objects in which the field |
|---|
| 384 | | specified in ``date_field`` is greater than the current date/time. By |
|---|
| 385 | | default, this is ``False``. |
|---|
| 386 | | |
|---|
| 387 | | **Template name:** |
|---|
| | 372 | Required arguments |
|---|
| | 373 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 374 | |
|---|
| | 375 | ``year`` |
|---|
| | 376 | The four-digit year for which the archive serves (a string). |
|---|
| | 377 | |
|---|
| | 378 | ``month`` |
|---|
| | 379 | The month for which the archive serves, formatted according to the |
|---|
| | 380 | ``month_format`` argument. |
|---|
| | 381 | |
|---|
| | 382 | ``queryset`` |
|---|
| | 383 | A ``QuerySet`` of objects for which the archive serves. |
|---|
| | 384 | |
|---|
| | 385 | ``date_field`` |
|---|
| | 386 | The name of the ``DateField`` or ``DateTimeField`` in the ``QuerySet``'s |
|---|
| | 387 | model that the date-based archive should use to determine the objects on |
|---|
| | 388 | the page. |
|---|
| | 389 | |
|---|
| | 390 | Optional arguments |
|---|
| | 391 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 392 | |
|---|
| | 393 | ``month_format`` |
|---|
| | 394 | A format string that regulates what format the ``month`` parameter uses. |
|---|
| | 395 | This should be in the syntax accepted by Python's ``time.strftime``. (See |
|---|
| | 396 | the `strftime docs`_.) It's set to ``"%b"`` by default, which is a three- |
|---|
| | 397 | letter month abbreviation. To change it to use numbers, use ``"%m"``. |
|---|
| | 398 | |
|---|
| | 399 | ``template_name`` |
|---|
| | 400 | The full name of a template to use in rendering the page. This lets you |
|---|
| | 401 | override the default template name (see below). |
|---|
| | 402 | |
|---|
| | 403 | ``template_loader`` |
|---|
| | 404 | The template loader to use when loading the template. By default, it's |
|---|
| | 405 | ``django.template.loader``. |
|---|
| | 406 | |
|---|
| | 407 | ``extra_context`` |
|---|
| | 408 | A dictionary of values to add to the template context. By default, this is |
|---|
| | 409 | an empty dictionary. If a value in the dictionary is callable, the generic |
|---|
| | 410 | view will call it just before rendering the template. |
|---|
| | 411 | |
|---|
| | 412 | ``allow_empty`` |
|---|
| | 413 | A boolean specifying whether to display the page if no objects are |
|---|
| | 414 | available. If this is ``False`` and no objects are available, the view will |
|---|
| | 415 | raise a 404 instead of displaying an empty page. By default, this is |
|---|
| | 416 | ``False``. |
|---|
| | 417 | |
|---|
| | 418 | ``context_processors`` |
|---|
| | 419 | A list of template-context processors to apply to the view's template. See |
|---|
| | 420 | the `RequestContext docs`_. |
|---|
| | 421 | |
|---|
| | 422 | ``template_object_name`` |
|---|
| | 423 | Designates the name of the template variable to use in the template |
|---|
| | 424 | context. By default, this is ``'object'``. The view will append ``'_list'`` |
|---|
| | 425 | to the value of this parameter in determining the variable's name. |
|---|
| | 426 | |
|---|
| | 427 | ``mimetype`` |
|---|
| | 428 | The MIME type to use for the resulting document. Defaults to the value of |
|---|
| | 429 | the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| | 430 | |
|---|
| | 431 | ``allow_future`` |
|---|
| | 432 | A boolean specifying whether to include "future" objects on this page, |
|---|
| | 433 | where "future" means objects in which the field specified in ``date_field`` |
|---|
| | 434 | is greater than the current date/time. By default, this is ``False``. |
|---|
| | 435 | |
|---|
| | 436 | Template name |
|---|
| | 437 | ~~~~~~~~~~~~~ |
|---|
| 421 | | **Required arguments:** |
|---|
| 422 | | |
|---|
| 423 | | * ``year``: The four-digit year for which the archive serves (a string). |
|---|
| 424 | | |
|---|
| 425 | | * ``week``: The week of the year for which the archive serves (a string). |
|---|
| 426 | | Weeks start with Sunday. |
|---|
| 427 | | |
|---|
| 428 | | * ``queryset``: A ``QuerySet`` of objects for which the archive serves. |
|---|
| 429 | | |
|---|
| 430 | | * ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in |
|---|
| 431 | | the ``QuerySet``'s model that the date-based archive should use to |
|---|
| 432 | | determine the objects on the page. |
|---|
| 433 | | |
|---|
| 434 | | **Optional arguments:** |
|---|
| 435 | | |
|---|
| 436 | | * ``template_name``: The full name of a template to use in rendering the |
|---|
| 437 | | page. This lets you override the default template name (see below). |
|---|
| 438 | | |
|---|
| 439 | | * ``template_loader``: The template loader to use when loading the |
|---|
| 440 | | template. By default, it's ``django.template.loader``. |
|---|
| 441 | | |
|---|
| 442 | | * ``extra_context``: A dictionary of values to add to the template |
|---|
| 443 | | context. By default, this is an empty dictionary. If a value in the |
|---|
| 444 | | dictionary is callable, the generic view will call it |
|---|
| 445 | | just before rendering the template. |
|---|
| 446 | | |
|---|
| 447 | | * ``allow_empty``: A boolean specifying whether to display the page if no |
|---|
| 448 | | objects are available. If this is ``False`` and no objects are available, |
|---|
| 449 | | the view will raise a 404 instead of displaying an empty page. By |
|---|
| 450 | | default, this is ``True``. |
|---|
| 451 | | |
|---|
| 452 | | * ``context_processors``: A list of template-context processors to apply to |
|---|
| 453 | | the view's template. See the `RequestContext docs`_. |
|---|
| 454 | | |
|---|
| 455 | | * ``template_object_name``: Designates the name of the template variable |
|---|
| 456 | | to use in the template context. By default, this is ``'object'``. The |
|---|
| 457 | | view will append ``'_list'`` to the value of this parameter in |
|---|
| 458 | | determining the variable's name. |
|---|
| 459 | | |
|---|
| 460 | | * ``mimetype``: The MIME type to use for the resulting document. Defaults |
|---|
| 461 | | to the value of the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| 462 | | |
|---|
| 463 | | * ``allow_future``: A boolean specifying whether to include "future" |
|---|
| 464 | | objects on this page, where "future" means objects in which the field |
|---|
| 465 | | specified in ``date_field`` is greater than the current date/time. By |
|---|
| 466 | | default, this is ``False``. |
|---|
| 467 | | |
|---|
| 468 | | **Template name:** |
|---|
| | 475 | Required arguments |
|---|
| | 476 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 477 | |
|---|
| | 478 | ``year`` |
|---|
| | 479 | The four-digit year for which the archive serves (a string). |
|---|
| | 480 | |
|---|
| | 481 | ``week`` |
|---|
| | 482 | The week of the year for which the archive serves (a string). Weeks start |
|---|
| | 483 | with Sunday. |
|---|
| | 484 | |
|---|
| | 485 | ``queryset`` |
|---|
| | 486 | A ``QuerySet`` of objects for which the archive serves. |
|---|
| | 487 | |
|---|
| | 488 | ``date_field`` |
|---|
| | 489 | The name of the ``DateField`` or ``DateTimeField`` in the ``QuerySet``'s |
|---|
| | 490 | model that the date-based archive should use to determine the objects on |
|---|
| | 491 | the page. |
|---|
| | 492 | |
|---|
| | 493 | Optional arguments |
|---|
| | 494 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 495 | |
|---|
| | 496 | ``template_name`` |
|---|
| | 497 | The full name of a template to use in rendering the page. This lets you |
|---|
| | 498 | override the default template name (see below). |
|---|
| | 499 | |
|---|
| | 500 | ``template_loader`` |
|---|
| | 501 | The template loader to use when loading the template. By default, it's |
|---|
| | 502 | ``django.template.loader``. |
|---|
| | 503 | |
|---|
| | 504 | ``extra_context`` |
|---|
| | 505 | A dictionary of values to add to the template context. By default, this is |
|---|
| | 506 | an empty dictionary. If a value in the dictionary is callable, the generic |
|---|
| | 507 | view will call it just before rendering the template. |
|---|
| | 508 | |
|---|
| | 509 | ``allow_empty`` |
|---|
| | 510 | A boolean specifying whether to display the page if no objects are |
|---|
| | 511 | available. If this is ``False`` and no objects are available, the view will |
|---|
| | 512 | raise a 404 instead of displaying an empty page. By default, this is |
|---|
| | 513 | ``True``. |
|---|
| | 514 | |
|---|
| | 515 | ``context_processors`` |
|---|
| | 516 | A list of template-context processors to apply to the view's template. See |
|---|
| | 517 | the `RequestContext docs`_. |
|---|
| | 518 | |
|---|
| | 519 | ``template_object_name`` |
|---|
| | 520 | Designates the name of the template variable to use in the template |
|---|
| | 521 | context. By default, this is ``'object'``. The view will append ``'_list'`` |
|---|
| | 522 | to the value of this parameter in determining the variable's name. |
|---|
| | 523 | |
|---|
| | 524 | ``mimetype`` |
|---|
| | 525 | The MIME type to use for the resulting document. Defaults to the value of |
|---|
| | 526 | the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| | 527 | |
|---|
| | 528 | ``allow_future`` |
|---|
| | 529 | A boolean specifying whether to include "future" objects on this page, |
|---|
| | 530 | where "future" means objects in which the field specified in ``date_field`` |
|---|
| | 531 | is greater than the current date/time. By default, this is ``False``. |
|---|
| | 532 | |
|---|
| | 533 | Template name |
|---|
| | 534 | ~~~~~~~~~~~~~ |
|---|
| 494 | | **Required arguments:** |
|---|
| 495 | | |
|---|
| 496 | | * ``year``: The four-digit year for which the archive serves (a string). |
|---|
| 497 | | |
|---|
| 498 | | * ``month``: The month for which the archive serves, formatted according to |
|---|
| 499 | | the ``month_format`` argument. |
|---|
| 500 | | |
|---|
| 501 | | * ``day``: The day for which the archive serves, formatted according to the |
|---|
| 502 | | ``day_format`` argument. |
|---|
| 503 | | |
|---|
| 504 | | * ``queryset``: A ``QuerySet`` of objects for which the archive serves. |
|---|
| 505 | | |
|---|
| 506 | | * ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in |
|---|
| 507 | | the ``QuerySet``'s model that the date-based archive should use to |
|---|
| 508 | | determine the objects on the page. |
|---|
| 509 | | |
|---|
| 510 | | **Optional arguments:** |
|---|
| 511 | | |
|---|
| 512 | | * ``month_format``: A format string that regulates what format the |
|---|
| 513 | | ``month`` parameter uses. This should be in the syntax accepted by |
|---|
| 514 | | Python's ``time.strftime``. (See the `strftime docs`_.) It's set to |
|---|
| 515 | | ``"%b"`` by default, which is a three-letter month abbreviation. To |
|---|
| 516 | | change it to use numbers, use ``"%m"``. |
|---|
| 517 | | |
|---|
| 518 | | * ``day_format``: Like ``month_format``, but for the ``day`` parameter. |
|---|
| 519 | | It defaults to ``"%d"`` (day of the month as a decimal number, 01-31). |
|---|
| 520 | | |
|---|
| 521 | | * ``template_name``: The full name of a template to use in rendering the |
|---|
| 522 | | page. This lets you override the default template name (see below). |
|---|
| 523 | | |
|---|
| 524 | | * ``template_loader``: The template loader to use when loading the |
|---|
| 525 | | template. By default, it's ``django.template.loader``. |
|---|
| 526 | | |
|---|
| 527 | | * ``extra_context``: A dictionary of values to add to the template |
|---|
| 528 | | context. By default, this is an empty dictionary. If a value in the |
|---|
| 529 | | dictionary is callable, the generic view will call it |
|---|
| 530 | | just before rendering the template. |
|---|
| 531 | | |
|---|
| 532 | | * ``allow_empty``: A boolean specifying whether to display the page if no |
|---|
| 533 | | objects are available. If this is ``False`` and no objects are available, |
|---|
| 534 | | the view will raise a 404 instead of displaying an empty page. By |
|---|
| 535 | | default, this is ``False``. |
|---|
| 536 | | |
|---|
| 537 | | * ``context_processors``: A list of template-context processors to apply to |
|---|
| 538 | | the view's template. See the `RequestContext docs`_. |
|---|
| 539 | | |
|---|
| 540 | | * ``template_object_name``: Designates the name of the template variable |
|---|
| 541 | | to use in the template context. By default, this is ``'object'``. The |
|---|
| 542 | | view will append ``'_list'`` to the value of this parameter in |
|---|
| 543 | | determining the variable's name. |
|---|
| 544 | | |
|---|
| 545 | | * ``mimetype``: The MIME type to use for the resulting document. Defaults |
|---|
| 546 | | to the value of the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| 547 | | |
|---|
| 548 | | * ``allow_future``: A boolean specifying whether to include "future" |
|---|
| 549 | | objects on this page, where "future" means objects in which the field |
|---|
| 550 | | specified in ``date_field`` is greater than the current date/time. By |
|---|
| 551 | | default, this is ``False``. |
|---|
| 552 | | |
|---|
| 553 | | **Template name:** |
|---|
| | 563 | Required arguments |
|---|
| | 564 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 565 | |
|---|
| | 566 | ``year`` |
|---|
| | 567 | The four-digit year for which the archive serves (a string). |
|---|
| | 568 | |
|---|
| | 569 | ``month`` |
|---|
| | 570 | The month for which the archive serves, formatted according to the |
|---|
| | 571 | ``month_format`` argument. |
|---|
| | 572 | |
|---|
| | 573 | ``day`` |
|---|
| | 574 | The day for which the archive serves, formatted according to the |
|---|
| | 575 | ``day_format`` argument. |
|---|
| | 576 | |
|---|
| | 577 | ``queryset`` |
|---|
| | 578 | A ``QuerySet`` of objects for which the archive serves. |
|---|
| | 579 | |
|---|
| | 580 | ``date_field`` |
|---|
| | 581 | The name of the ``DateField`` or ``DateTimeField`` in the ``QuerySet``'s |
|---|
| | 582 | model that the date-based archive should use to determine the objects on |
|---|
| | 583 | the page. |
|---|
| | 584 | |
|---|
| | 585 | Optional arguments |
|---|
| | 586 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 587 | |
|---|
| | 588 | ``month_format`` |
|---|
| | 589 | A format string that regulates what format the ``month`` parameter uses. |
|---|
| | 590 | This should be in the syntax accepted by Python's ``time.strftime``. (See |
|---|
| | 591 | the `strftime docs`_.) It's set to ``"%b"`` by default, which is a three- |
|---|
| | 592 | letter month abbreviation. To change it to use numbers, use ``"%m"``. |
|---|
| | 593 | |
|---|
| | 594 | ``day_format`` |
|---|
| | 595 | Like ``month_format``, but for the ``day`` parameter. It defaults to |
|---|
| | 596 | ``"%d"`` (day of the month as a decimal number, 01-31). |
|---|
| | 597 | |
|---|
| | 598 | ``template_name`` |
|---|
| | 599 | The full name of a template to use in rendering the page. This lets you |
|---|
| | 600 | override the default template name (see below). |
|---|
| | 601 | |
|---|
| | 602 | ``template_loader`` |
|---|
| | 603 | The template loader to use when loading the template. By default, it's |
|---|
| | 604 | ``django.template.loader``. |
|---|
| | 605 | |
|---|
| | 606 | ``extra_context`` |
|---|
| | 607 | A dictionary of values to add to the template context. By default, this is |
|---|
| | 608 | an empty dictionary. If a value in the dictionary is callable, the generic |
|---|
| | 609 | view will call it just before rendering the template. |
|---|
| | 610 | |
|---|
| | 611 | ``allow_empty`` |
|---|
| | 612 | A boolean specifying whether to display the page if no objects are |
|---|
| | 613 | available. If this is ``False`` and no objects are available, the view will |
|---|
| | 614 | raise a 404 instead of displaying an empty page. By default, this is |
|---|
| | 615 | ``False``. |
|---|
| | 616 | |
|---|
| | 617 | ``context_processors`` |
|---|
| | 618 | A list of template-context processors to apply to the view's template. See |
|---|
| | 619 | the `RequestContext docs`_. |
|---|
| | 620 | |
|---|
| | 621 | ``template_object_name`` |
|---|
| | 622 | Designates the name of the template variable to use in the template |
|---|
| | 623 | context. By default, this is ``'object'``. The view will append |
|---|
| | 624 | ``'_list'`` to the value of this parameter in determining the variable's |
|---|
| | 625 | name. |
|---|
| | 626 | |
|---|
| | 627 | ``mimetype`` |
|---|
| | 628 | The MIME type to use for the resulting document. Defaults to the value of |
|---|
| | 629 | the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| | 630 | |
|---|
| | 631 | ``allow_future`` |
|---|
| | 632 | A boolean specifying whether to include "future" objects on this page, |
|---|
| | 633 | where "future" means objects in which the field specified in ``date_field`` |
|---|
| | 634 | is greater than the current date/time. By default, this is ``False``. |
|---|
| | 635 | |
|---|
| | 636 | Template name |
|---|
| | 637 | ~~~~~~~~~~~~~ |
|---|
| 593 | | **Required arguments:** |
|---|
| 594 | | |
|---|
| 595 | | * ``year``: The object's four-digit year (a string). |
|---|
| 596 | | |
|---|
| 597 | | * ``month``: The object's month , formatted according to the |
|---|
| 598 | | ``month_format`` argument. |
|---|
| 599 | | |
|---|
| 600 | | * ``day``: The object's day , formatted according to the ``day_format`` |
|---|
| 601 | | argument. |
|---|
| 602 | | |
|---|
| 603 | | * ``queryset``: A ``QuerySet`` that contains the object. |
|---|
| 604 | | |
|---|
| 605 | | * ``date_field``: The name of the ``DateField`` or ``DateTimeField`` in |
|---|
| 606 | | the ``QuerySet``'s model that the generic view should use to look up the |
|---|
| 607 | | object according to ``year``, ``month`` and ``day``. |
|---|
| 608 | | |
|---|
| 609 | | * Either ``object_id`` or (``slug`` *and* ``slug_field``) is required. |
|---|
| 610 | | |
|---|
| 611 | | If you provide ``object_id``, it should be the value of the primary-key |
|---|
| 612 | | field for the object being displayed on this page. |
|---|
| 613 | | |
|---|
| 614 | | Otherwise, ``slug`` should be the slug of the given object, and |
|---|
| 615 | | ``slug_field`` should be the name of the slug field in the ``QuerySet``'s |
|---|
| 616 | | model. By default, ``slug_field`` is ``'slug'``. |
|---|
| 617 | | |
|---|
| 618 | | **Optional arguments:** |
|---|
| 619 | | |
|---|
| 620 | | * ``month_format``: A format string that regulates what format the |
|---|
| 621 | | ``month`` parameter uses. This should be in the syntax accepted by |
|---|
| 622 | | Python's ``time.strftime``. (See the `strftime docs`_.) It's set to |
|---|
| 623 | | ``"%b"`` by default, which is a three-letter month abbreviation. To |
|---|
| 624 | | change it to use numbers, use ``"%m"``. |
|---|
| 625 | | |
|---|
| 626 | | * ``day_format``: Like ``month_format``, but for the ``day`` parameter. |
|---|
| 627 | | It defaults to ``"%d"`` (day of the month as a decimal number, 01-31). |
|---|
| 628 | | |
|---|
| 629 | | * ``template_name``: The full name of a template to use in rendering the |
|---|
| 630 | | page. This lets you override the default template name (see below). |
|---|
| 631 | | |
|---|
| 632 | | * ``template_name_field``: The name of a field on the object whose value is |
|---|
| 633 | | the template name to use. This lets you store template names in the data. |
|---|
| 634 | | In other words, if your object has a field ``'the_template'`` that |
|---|
| 635 | | contains a string ``'foo.html'``, and you set ``template_name_field`` to |
|---|
| 636 | | ``'the_template'``, then the generic view for this object will use the |
|---|
| 637 | | template ``'foo.html'``. |
|---|
| 638 | | |
|---|
| 639 | | It's a bit of a brain-bender, but it's useful in some cases. |
|---|
| 640 | | |
|---|
| 641 | | * ``template_loader``: The template loader to use when loading the |
|---|
| 642 | | template. By default, it's ``django.template.loader``. |
|---|
| 643 | | |
|---|
| 644 | | * ``extra_context``: A dictionary of values to add to the template |
|---|
| 645 | | context. By default, this is an empty dictionary. If a value in the |
|---|
| 646 | | dictionary is callable, the generic view will call it |
|---|
| 647 | | just before rendering the template. |
|---|
| 648 | | |
|---|
| 649 | | * ``context_processors``: A list of template-context processors to apply to |
|---|
| 650 | | the view's template. See the `RequestContext docs`_. |
|---|
| 651 | | |
|---|
| 652 | | * ``template_object_name``: Designates the name of the template variable |
|---|
| 653 | | to use in the template context. By default, this is ``'object'``. |
|---|
| 654 | | |
|---|
| 655 | | * ``mimetype``: The MIME type to use for the resulting document. Defaults |
|---|
| 656 | | to the value of the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| 657 | | |
|---|
| 658 | | * ``allow_future``: A boolean specifying whether to include "future" |
|---|
| 659 | | objects on this page, where "future" means objects in which the field |
|---|
| 660 | | specified in ``date_field`` is greater than the current date/time. By |
|---|
| 661 | | default, this is ``False``. |
|---|
| 662 | | |
|---|
| 663 | | **Template name:** |
|---|
| | 684 | Required arguments |
|---|
| | 685 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 686 | |
|---|
| | 687 | ``year`` |
|---|
| | 688 | The object's four-digit year (a string). |
|---|
| | 689 | |
|---|
| | 690 | ``month`` |
|---|
| | 691 | The object's month , formatted according to the ``month_format`` argument. |
|---|
| | 692 | |
|---|
| | 693 | ``day`` |
|---|
| | 694 | The object's day , formatted according to the ``day_format`` argument. |
|---|
| | 695 | |
|---|
| | 696 | ``queryset`` |
|---|
| | 697 | A ``QuerySet`` that contains the object. |
|---|
| | 698 | |
|---|
| | 699 | ``date_field`` |
|---|
| | 700 | The name of the ``DateField`` or ``DateTimeField`` in the ``QuerySet``'s |
|---|
| | 701 | model that the generic view should use to look up the object according to |
|---|
| | 702 | ``year``, ``month`` and ``day``. |
|---|
| | 703 | |
|---|
| | 704 | Either ``object_id`` or (``slug`` *and* ``slug_field``) is required. |
|---|
| | 705 | If you provide ``object_id``, it should be the value of the primary-key |
|---|
| | 706 | field for the object being displayed on this page. |
|---|
| | 707 | |
|---|
| | 708 | Otherwise, ``slug`` should be the slug of the given object, and |
|---|
| | 709 | ``slug_field`` should be the name of the slug field in the ``QuerySet``'s |
|---|
| | 710 | model. By default, ``slug_field`` is ``'slug'``. |
|---|
| | 711 | |
|---|
| | 712 | Optional arguments |
|---|
| | 713 | ~~~~~~~~~~~~~~~~~~ |
|---|
| | 714 | |
|---|
| | 715 | ``month_format`` |
|---|
| | 716 | A format string that regulates what format the ``month`` parameter uses. |
|---|
| | 717 | This should be in the syntax accepted by Python's ``time.strftime``. (See |
|---|
| | 718 | the `strftime docs`_.) It's set to ``"%b"`` by default, which is a three- |
|---|
| | 719 | letter month abbreviation. To change it to use numbers, use ``"%m"``. |
|---|
| | 720 | |
|---|
| | 721 | ``day_format`` |
|---|
| | 722 | Like ``month_format``, but for the ``day`` parameter. It defaults to |
|---|
| | 723 | ``"%d"`` (day of the month as a decimal number, 01-31). |
|---|
| | 724 | |
|---|
| | 725 | ``template_name`` |
|---|
| | 726 | The full name of a template to use in rendering the page. This lets you |
|---|
| | 727 | override the default template name (see below). |
|---|
| | 728 | |
|---|
| | 729 | ``template_name_field`` |
|---|
| | 730 | The name of a field on the object whose value is the template name to use. |
|---|
| | 731 | This lets you store template names in the data. In other words, if your |
|---|
| | 732 | object has a field ``'the_template'`` that contains a string |
|---|
| | 733 | ``'foo.html'``, and you set ``template_name_field`` to ``'the_template'``, |
|---|
| | 734 | then the generic view for this object will use the template ``'foo.html'``. |
|---|
| | 735 | |
|---|
| | 736 | It's a bit of a brain-bender, but it's useful in some cases. |
|---|
| | 737 | |
|---|
| | 738 | ``template_loader`` |
|---|
| | 739 | The template loader to use when loading the template. By default, it's |
|---|
| | 740 | ``django.template.loader``. |
|---|
| | 741 | |
|---|
| | 742 | ``extra_context`` |
|---|
| | 743 | A dictionary of values to add to the template context. By default, this is |
|---|
| | 744 | an empty dictionary. If a value in the dictionary is callable, the generic |
|---|
| | 745 | view will call it just before rendering the template. |
|---|
| | 746 | |
|---|
| | 747 | ``context_processors`` |
|---|
| | 748 | A list of template-context processors to apply to the view's template. See |
|---|
| | 749 | the `RequestContext docs`_. |
|---|
| | 750 | |
|---|
| | 751 | ``template_object_name`` |
|---|
| | 752 | Designates the name of the template variable to use in the template |
|---|
| | 753 | context. By default, this is ``'object'``. |
|---|
| | 754 | |
|---|
| | 755 | ``mimetype`` |
|---|
| | 756 | The MIME type to use for the resulting document. Defaults to the value of |
|---|
| | 757 | the ``DEFAULT_CONTENT_TYPE`` setting. |
|---|
| | 758 | |
|---|
| | 759 | ``allow_future`` |
|---|
| | 760 | A boolean specifying whether to include "future" objects on this page, |
|---|
| | 761 | where "future" means objects in which the field specified in ``date_field`` |
|---|
| | 762 | is greater than the current date/time. By default, this is ``False``. |
|---|
| | 763 | |
|---|
| | 764 | Template name |
|---|
| | 765 | ~~~~~~~~~~~~~ |
|---|