這里的索引提供基于類的視圖的另外一種組織形式。對于每個視圖,在類繼承樹中有效的屬性和方法都顯示在該視圖的下方。按照行為進行組織的文檔,參見基于類的視圖。
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 文檔協(xié)作翻譯小組,原文:Flattened index。
本文以 CC BY-NC-SA 3.0 協(xié)議發(fā)布,轉(zhuǎn)載請保留作者署名和文章出處。
Django 文檔協(xié)作翻譯小組人手緊缺,有興趣的朋友可以加入我們,完全公益性質(zhì)。交流群:467338606。