这里的索引提供基于类的视图的另外一种组织形式。对于每个视图,在类继承树中有效的属性和方法都显示在该视图的下方。按照行为进行组织的文档,参见基于类的视图。
class View
属性 (以及访问它们的方法):
http_method_names方法
as_view()dispatch()head()http_method_not_allowed()class TemplateView
属性 (以及访问它们的方法):
content_typehttp_method_namesresponse_class [render_to_response()]template_enginetemplate_name [get_template_names()]方法
as_view()dispatch()get()get_context_data()head()http_method_not_allowed()render_to_response()class RedirectView
属性 (以及访问它们的方法):
http_method_namespattern_namepermanentquery_stringurl [get_redirect_url()]方法
as_view()delete()dispatch()get()head()http_method_not_allowed()options()post()put()class DetailView
属性 (以及访问它们的方法):
content_typecontext_object_name [get_context_object_name()]http_method_namesmodelpk_url_kwargqueryset [get_queryset()]response_class [render_to_response()]slug_field [get_slug_field()]slug_url_kwargtemplate_enginetemplate_name [get_template_names()]template_name_fieldtemplate_name_suffix方法
as_view()dispatch()get()get_context_data()get_object()head()http_method_not_allowed()render_to_response()class ListView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]content_typecontext_object_name [get_context_object_name()]http_method_namesmodelordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffix方法
as_view()dispatch()get()get_context_data()get_paginator()head()http_method_not_allowed()paginate_queryset()render_to_response()class FormView
属性 (以及访问它们的方法):
content_typeform_class [get_form_class()]http_method_namesinitial [get_initial()]prefix [get_prefix()]response_class [render_to_response()]success_url [get_success_url()]template_enginetemplate_name [get_template_names()]方法
as_view()dispatch()form_invalid()form_valid()get()get_context_data()get_form()get_form_kwargs()http_method_not_allowed()post()put()class CreateView
属性 (以及访问它们的方法):
content_typecontext_object_name [get_context_object_name()]fieldsform_class [get_form_class()]http_method_namesinitial [get_initial()]modelpk_url_kwargprefix [get_prefix()]queryset [get_queryset()]response_class [render_to_response()]slug_field [get_slug_field()]slug_url_kwargsuccess_url [get_success_url()]template_enginetemplate_name [get_template_names()]template_name_fieldtemplate_name_suffix方法
as_view()dispatch()form_invalid()form_valid()get()get_context_data()get_form()get_form_kwargs()get_object()head()http_method_not_allowed()post()put()render_to_response()class UpdateView
属性 (以及访问它们的方法):
content_typecontext_object_name [get_context_object_name()]fieldsform_class [get_form_class()]http_method_namesinitial [get_initial()]modelpk_url_kwargprefix [get_prefix()]queryset [get_queryset()]response_class [render_to_response()]slug_field [get_slug_field()]slug_url_kwargsuccess_url [get_success_url()]template_enginetemplate_name [get_template_names()]template_name_fieldtemplate_name_suffix方法
as_view()dispatch()form_invalid()form_valid()get()get_context_data()get_form()get_form_kwargs()get_object()head()http_method_not_allowed()post()put()render_to_response()class DeleteView
属性 (以及访问它们的方法):
content_typecontext_object_name [get_context_object_name()]http_method_namesmodelpk_url_kwargqueryset [get_queryset()]response_class [render_to_response()]slug_field [get_slug_field()]slug_url_kwargsuccess_url [get_success_url()]template_enginetemplate_name [get_template_names()]template_name_fieldtemplate_name_suffix方法
as_view()delete()dispatch()get()get_context_data()get_object()head()http_method_not_allowed()post()render_to_response()class ArchiveIndexView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]http_method_namesmodelordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffix方法
as_view()dispatch()get()get_context_data()get_date_list()get_dated_items()get_dated_queryset()get_paginator()head()http_method_not_allowed()paginate_queryset()render_to_response()class YearArchiveView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]http_method_namesmake_object_list [get_make_object_list()]modelordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffixyear [get_year()]year_format [get_year_format()]方法
as_view()dispatch()get()get_context_data()get_date_list()get_dated_items()get_dated_queryset()get_paginator()head()http_method_not_allowed()paginate_queryset()render_to_response()class MonthArchiveView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]http_method_namesmodelmonth [get_month()]month_format [get_month_format()]ordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffixyear [get_year()]year_format [get_year_format()]方法
as_view()dispatch()get()get_context_data()get_date_list()get_dated_items()get_dated_queryset()get_next_month()get_paginator()get_previous_month()head()http_method_not_allowed()paginate_queryset()render_to_response()class WeekArchiveView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]http_method_namesmodelordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffixweek [get_week()]week_format [get_week_format()]year [get_year()]year_format [get_year_format()]方法
as_view()dispatch()get()get_context_data()get_date_list()get_dated_items()get_dated_queryset()get_paginator()head()http_method_not_allowed()paginate_queryset()render_to_response()class DayArchiveView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]day [get_day()]day_format [get_day_format()]http_method_namesmodelmonth [get_month()]month_format [get_month_format()]ordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffixyear [get_year()]year_format [get_year_format()]方法
as_view()dispatch()get()get_context_data()get_date_list()get_dated_items()get_dated_queryset()get_next_day()get_next_month()get_paginator()get_previous_day()get_previous_month()head()http_method_not_allowed()paginate_queryset()render_to_response()class TodayArchiveView
属性 (以及访问它们的方法):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]day [get_day()]day_format [get_day_format()]http_method_namesmodelmonth [get_month()]month_format [get_month_format()]ordering [get_ordering()]paginate_by [get_paginate_by()]paginate_orphans [get_paginate_orphans()]paginator_classqueryset [get_queryset()]response_class [render_to_response()]template_enginetemplate_name [get_template_names()]template_name_suffixyear [get_year()]year_format [get_year_format()]方法
as_view()dispatch()get()get_context_data()get_date_list()get_dated_items()get_dated_queryset()get_next_day()get_next_month()get_paginator()get_previous_day()get_previous_month()head()http_method_not_allowed()paginate_queryset()render_to_response()class DateDetailView
属性 (以及访问它们的方法):
allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]day [get_day()]day_format [get_day_format()]http_method_namesmodelmonth [get_month()]month_format [get_month_format()]pk_url_kwargqueryset [get_queryset()]response_class [render_to_response()]slug_field [get_slug_field()]slug_url_kwargtemplate_enginetemplate_name [get_template_names()]template_name_fieldtemplate_name_suffixyear [get_year()]year_format [get_year_format()]方法
as_view()dispatch()get()get_context_data()get_next_day()get_next_month()get_object()get_previous_day()get_previous_month()head()http_method_not_allowed()render_to_response()译者:Django 文档协作翻译小组,原文:Flattened index。
本文以 CC BY-NC-SA 3.0 协议发布,转载请保留作者署名和文章出处。
Django 文档协作翻译小组人手紧缺,有兴趣的朋友可以加入我们,完全公益性质。交流群:467338606。