该索引提供了基于类的视图的参考文档的另一种组织形式。对于每个视图,类树中的有效属性和方法都在该视图下表示。关于按定义行为的类组织的参考文档,见 基于类的视图。
参见
基于类的经典视图 提供了一个很好的界面来浏览内置的基于类的视图的类层次结构。
TemplateView¶TemplateView¶属性 (有可选的存取器):
content_typeextra_contexthttp_method_namesresponse_class [render_to_response()]template_enginetemplate_name [get_template_names()]方法
RedirectView¶RedirectView¶属性 (有可选的存取器):
方法
as_view()delete()dispatch()get()head()http_method_not_allowed()options()post()put()setup()DetailView¶DetailView¶属性 (有可选的存取器):
content_typecontext_object_name [get_context_object_name()]extra_contexthttp_method_namesmodelpk_url_kwargquery_pk_and_slugqueryset [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方法
ListView¶ListView¶属性 (有可选的存取器):
allow_empty [get_allow_empty()]content_typecontext_object_name [get_context_object_name()]extra_contexthttp_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方法
FormView¶FormView¶属性 (有可选的存取器):
content_typeextra_contextform_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()]方法
CreateView¶CreateView¶属性 (有可选的存取器):
content_typecontext_object_name [get_context_object_name()]extra_contextfieldsform_class [get_form_class()]http_method_namesinitial [get_initial()]modelpk_url_kwargprefix [get_prefix()]query_pk_and_slugqueryset [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方法
UpdateView¶UpdateView¶属性 (有可选的存取器):
content_typecontext_object_name [get_context_object_name()]extra_contextfieldsform_class [get_form_class()]http_method_namesinitial [get_initial()]modelpk_url_kwargprefix [get_prefix()]query_pk_and_slugqueryset [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方法
DeleteView¶DeleteView¶属性 (有可选的存取器):
content_typecontext_object_name [get_context_object_name()]extra_contexthttp_method_namesmodelpk_url_kwargquery_pk_and_slugqueryset [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()setup()ArchiveIndexView¶ArchiveIndexView¶属性 (有可选的存取器):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]extra_contexthttp_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方法
YearArchiveView¶YearArchiveView¶属性 (有可选的存取器):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]extra_contexthttp_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()]方法
MonthArchiveView¶MonthArchiveView¶属性 (有可选的存取器):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]extra_contexthttp_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()]方法
WeekArchiveView¶WeekArchiveView¶属性 (有可选的存取器):
allow_empty [get_allow_empty()]allow_future [get_allow_future()]content_typecontext_object_name [get_context_object_name()]date_field [get_date_field()]extra_contexthttp_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()]方法
DayArchiveView¶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()]extra_contexthttp_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()]方法
TodayArchiveView¶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()]extra_contexthttp_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()]方法
DateDetailView¶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()]extra_contexthttp_method_namesmodelmonth [get_month()]month_format [get_month_format()]pk_url_kwargquery_pk_and_slugqueryset [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()]方法
9月 22, 2023