Django Book 翻译
菜单>:
TOC
返回
原文:
.. table:: Table D-1. Common Arguments to Generic Views +------------------------+---------------------------------------------------------------+ |Argument |Description | +========================+===============================================================+ |``allow_empty`` |A Boolean specifying whether to display the page if no objects | | |are available. If this is ``False`` and no objects are | | |available, the view will raise a 404 error instead of | | |displaying an empty page. By default, this is ``False`` . | +------------------------+---------------------------------------------------------------+ |``context_processors`` |A list of additional template-context processors (besides the | | |defaults) to apply to the views template. See Chapter 10 for | | |information on template context processors. | +------------------------+---------------------------------------------------------------+ |``extra_context`` |A dictionary of values to add to the template context. By | | |default, this is an empty dictionary. If a value in the | | |dictionary is callable, the generic view will call it just | | |before rendering the template. | +------------------------+---------------------------------------------------------------+ |``mimetype`` |The MIME type to use for the resulting document. It defaults to| | |the value of the ``DEFAULT_MIME_TYPE`` setting, which is | | |``text/html`` if you havent changed it. | +------------------------+---------------------------------------------------------------+ |``queryset`` |A ``QuerySet`` (i.e., something like ``Author.objects.all()`` )| | |to read objects from. See Appendix C for more information about| | |``QuerySet`` objects. Most generic views require this argument.| +------------------------+---------------------------------------------------------------+ |``template_loader`` |The template loader to use when loading the template. By | | |default, its ``django.template.loader`` . See Chapter 10 for | | |information on template loaders. | +------------------------+---------------------------------------------------------------+ |``template_name`` |The full name of a template to use in rendering the page. This | | |lets you override the default template name derived from the | | |``QuerySet`` . | +------------------------+---------------------------------------------------------------+ |``template_object_name``|The name of the template variable to use in the template | | |context. By default, this is ``'object'`` . Views that list | | |more than one object (i.e., ``object_list`` views and various | | |objects-for-date views) will append ``'_list'`` to the value of| | |this parameter. | +------------------------+---------------------------------------------------------------+
翻译:
.. table:: Table D-1. Common Arguments to Generic Views +------------------------+---------------------------------------------------------------+ |参数 |描述 | +========================+===============================================================+ |``allow_empty`` |A Boolean specifying whether to display the page if no objects | | |are available. If this is ``False`` and no objects are | | |available, the view will raise a 404 error instead of | | |displaying an empty page. By default, this is ``False`` . | +------------------------+---------------------------------------------------------------+ |``context_processors`` |A list of additional template-context processors (besides the | | |defaults) to apply to the views template. See Chapter 10 for | | |information on template context processors. | +------------------------+---------------------------------------------------------------+ |``extra_context`` |A dictionary of values to add to the template context. By | | |default, this is an empty dictionary. If a value in the | | |dictionary is callable, the generic view will call it just | | |before rendering the template. | +------------------------+---------------------------------------------------------------+ |``mimetype`` |The MIME type to use for the resulting document. It defaults to| | |the value of the ``DEFAULT_MIME_TYPE`` setting, which is | | |``text/html`` if you havent changed it. | +------------------------+---------------------------------------------------------------+ |``queryset`` |A ``QuerySet`` (i.e., something like ``Author.objects.all()`` )| | |to read objects from. See Appendix C for more information about| | |``QuerySet`` objects. Most generic views require this argument.| +------------------------+---------------------------------------------------------------+ |``template_loader`` |The template loader to use when loading the template. By | | |default, its ``django.template.loader`` . See Chapter 10 for | | |information on template loaders. | +------------------------+---------------------------------------------------------------+ |``template_name`` |The full name of a template to use in rendering the page. This | | |lets you override the default template name derived from the | | |``QuerySet`` . | +------------------------+---------------------------------------------------------------+ |``template_object_name``|The name of the template variable to use in the template | | |context. By default, this is ``'object'`` . Views that list | | |more than one object (i.e., ``object_list`` views and various | | |objects-for-date views) will append ``'_list'`` to the value of| | |this parameter. | +------------------------+---------------------------------------------------------------+
备注:
译者: