Class-based generic views - flattened index
This index provides an alternate organization of the reference documentationfor class-based views. For each view, the effective attributes and methods fromthe class tree are represented under that view. For the referencedocumentation organized by the class which defines the behavior, seeClass-based views.
参见
Classy Class-Based Views provides a nice interfaceto navigate the class hierarchy of the built-in class-based views.
Simple generic views
View
- class
View
Attributes (with optional accessor):
dispatch()
head()
http_method_not_allowed()
setup()
TemplateView
- class
TemplateView
Attributes (with optional accessor):
extra_context
http_method_names
response_class
[render_to_response()
]template_engine
dispatch()
get()
get_context_data()
head()
http_method_not_allowed()
render_to_response()
setup()
RedirectView
- class
RedirectView
Attributes (with optional accessor):
pattern_name
permanent
query_string
delete()
dispatch()
get()
head()
http_method_not_allowed()
options()
post()
put()
setup()
详情视图
DetailView
- class
DetailView
Attributes (with optional accessor):
context_object_name
[get_context_object_name()
]extra_context
http_method_names
model
pk_url_kwarg
queryset
[get_queryset()
]response_class
[render_to_response()
]slug_field
[get_slug_field()
]slug_url_kwarg
template_engine
template_name
[get_template_names()
]template_name_field
dispatch()
get()
get_context_data()
get_object()
head()
http_method_not_allowed()
render_to_response()
setup()
列表视图
ListView
- class
ListView
Attributes (with optional accessor):
content_type
context_object_name
[get_context_object_name()
]extra_context
http_method_names
model
ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]dispatch()
get()
get_context_data()
get_paginator()
head()
http_method_not_allowed()
paginate_queryset()
render_to_response()
setup()
编辑视图
FormView
- class
FormView
Attributes (with optional accessor):
extra_context
form_class
[get_form_class()
]http_method_names
initial
[get_initial()
]prefix
[get_prefix()
]response_class
[render_to_response()
]success_url
[get_success_url()
]template_engine
dispatch()
form_invalid()
form_valid()
get()
get_context_data()
get_form()
get_form_kwargs()
http_method_not_allowed()
post()
put()
setup()
CreateView
- class
CreateView
Attributes (with optional accessor):
context_object_name
[get_context_object_name()
]extra_context
fields
form_class
[get_form_class()
]http_method_names
initial
[get_initial()
]model
pk_url_kwarg
prefix
[get_prefix()
]queryset
[get_queryset()
]response_class
[render_to_response()
]slug_field
[get_slug_field()
]slug_url_kwarg
success_url
[get_success_url()
]template_engine
template_name
[get_template_names()
]template_name_field
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()
setup()
UpdateView
- class
UpdateView
Attributes (with optional accessor):
context_object_name
[get_context_object_name()
]extra_context
fields
form_class
[get_form_class()
]http_method_names
initial
[get_initial()
]model
pk_url_kwarg
prefix
[get_prefix()
]queryset
[get_queryset()
]response_class
[render_to_response()
]slug_field
[get_slug_field()
]slug_url_kwarg
success_url
[get_success_url()
]template_engine
template_name
[get_template_names()
]template_name_field
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()
setup()
DeleteView
- class
DeleteView
Attributes (with optional accessor):
context_object_name
[get_context_object_name()
]extra_context
http_method_names
model
pk_url_kwarg
queryset
[get_queryset()
]response_class
[render_to_response()
]slug_field
[get_slug_field()
]slug_url_kwarg
success_url
[get_success_url()
]template_engine
template_name
[get_template_names()
]template_name_field
delete()
dispatch()
get()
get_context_data()
get_object()
head()
http_method_not_allowed()
post()
render_to_response()
setup()
基于日期的视图
ArchiveIndexView
- class
ArchiveIndexView
Attributes (with optional accessor):
allow_future
[get_allow_future()
]content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]extra_context
http_method_names
model
ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]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()
setup()
YearArchiveView
- class
YearArchiveView
Attributes (with optional accessor):
allow_future
[get_allow_future()
]content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]extra_context
http_method_names
make_object_list
[get_make_object_list()
]model
ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]template_name_suffix
year
[get_year()
]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()
setup()
MonthArchiveView
- class
MonthArchiveView
Attributes (with optional accessor):
allow_future
[get_allow_future()
]content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]extra_context
http_method_names
model
month
[get_month()
]month_format
[get_month_format()
]ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]template_name_suffix
year
[get_year()
]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()
setup()
WeekArchiveView
- class
WeekArchiveView
Attributes (with optional accessor):
allow_future
[get_allow_future()
]content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]extra_context
http_method_names
model
ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]template_name_suffix
week
[get_week()
]week_format
[get_week_format()
]year
[get_year()
]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()
setup()
DayArchiveView
- class
DayArchiveView
Attributes (with optional accessor):
allow_future
[get_allow_future()
]content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]day
[get_day()
]day_format
[get_day_format()
]extra_context
http_method_names
model
month
[get_month()
]month_format
[get_month_format()
]ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]template_name_suffix
year
[get_year()
]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()
setup()
TodayArchiveView
- class
TodayArchiveView
Attributes (with optional accessor):
allow_future
[get_allow_future()
]content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]day
[get_day()
]day_format
[get_day_format()
]extra_context
http_method_names
model
month
[get_month()
]month_format
[get_month_format()
]ordering
[get_ordering()
]paginate_by
[get_paginate_by()
]paginate_orphans
[get_paginate_orphans()
]paginator_class
queryset
[get_queryset()
]response_class
[render_to_response()
]template_engine
template_name
[get_template_names()
]template_name_suffix
year
[get_year()
]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()
setup()
DateDetailView
- class
DateDetailView
Attributes (with optional accessor):
content_type
context_object_name
[get_context_object_name()
]date_field
[get_date_field()
]day
[get_day()
]day_format
[get_day_format()
]extra_context
http_method_names
model
month
[get_month()
]month_format
[get_month_format()
]pk_url_kwarg
queryset
[get_queryset()
]response_class
[render_to_response()
]slug_field
[get_slug_field()
]slug_url_kwarg
template_engine
template_name
[get_template_names()
]template_name_field
template_name_suffix
year
[get_year()
]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()
setup()