Merge pull request #261 from issackelly/cbv-full-list
Create headings and expand CBV docs so that the "Built-In CBV" docs include a full list.
This commit is contained in:
commit
4eaf73d7bc
|
@ -8,6 +8,9 @@ themselves or inherited from. They may not provide all the capabilities
|
|||
required for projects, in which case there are Mixins and Generic class-based
|
||||
views.
|
||||
|
||||
View
|
||||
----
|
||||
|
||||
.. class:: django.views.generic.base.View
|
||||
|
||||
The master class-based base view. All other class-based views inherit from
|
||||
|
@ -68,6 +71,9 @@ views.
|
|||
methods defined directly on the class are documented here, not methods
|
||||
defined on superclasses.
|
||||
|
||||
TemplateView
|
||||
------------
|
||||
|
||||
.. class:: django.views.generic.base.TemplateView
|
||||
|
||||
Renders a given template, passing it a ``{{ params }}`` template variable,
|
||||
|
@ -132,6 +138,9 @@ views.
|
|||
methods defined directly on the class are documented here, not methods
|
||||
defined on superclasses.
|
||||
|
||||
RedirectView
|
||||
------------
|
||||
|
||||
.. class:: django.views.generic.base.RedirectView
|
||||
|
||||
Redirects to a given URL.
|
||||
|
|
|
@ -5,6 +5,9 @@ Generic date views
|
|||
Date-based generic views (in the module :mod:`django.views.generic.dates`)
|
||||
are views for displaying drilldown pages for date-based data.
|
||||
|
||||
ArchiveIndexView
|
||||
----------------
|
||||
|
||||
.. class:: django.views.generic.dates.ArchiveIndexView
|
||||
|
||||
A top-level index page showing the "latest" objects, by date. Objects with
|
||||
|
@ -27,6 +30,9 @@ are views for displaying drilldown pages for date-based data.
|
|||
* Uses a default ``context_object_name`` of ``latest``.
|
||||
* Uses a default ``template_name_suffix`` of ``_archive``.
|
||||
|
||||
YearArchiveView
|
||||
---------------
|
||||
|
||||
.. class:: django.views.generic.dates.YearArchiveView
|
||||
|
||||
A yearly archive page showing all available months in a given year. Objects
|
||||
|
@ -86,6 +92,9 @@ are views for displaying drilldown pages for date-based data.
|
|||
|
||||
* Uses a default ``template_name_suffix`` of ``_archive_year``.
|
||||
|
||||
MonthArchiveView
|
||||
----------------
|
||||
|
||||
.. class:: django.views.generic.dates.MonthArchiveView
|
||||
|
||||
A monthly archive page showing all objects in a given month. Objects with a
|
||||
|
@ -134,6 +143,9 @@ are views for displaying drilldown pages for date-based data.
|
|||
|
||||
* Uses a default ``template_name_suffix`` of ``_archive_month``.
|
||||
|
||||
WeekArchiveView
|
||||
---------------
|
||||
|
||||
.. class:: django.views.generic.dates.WeekArchiveView
|
||||
|
||||
A weekly archive page showing all objects in a given week. Objects with a
|
||||
|
@ -175,6 +187,9 @@ are views for displaying drilldown pages for date-based data.
|
|||
|
||||
* Uses a default ``template_name_suffix`` of ``_archive_week``.
|
||||
|
||||
DayArchiveView
|
||||
--------------
|
||||
|
||||
.. class:: django.views.generic.dates.DayArchiveView
|
||||
|
||||
A day archive page showing all objects in a given day. Days in the future
|
||||
|
@ -225,6 +240,9 @@ are views for displaying drilldown pages for date-based data.
|
|||
|
||||
* Uses a default ``template_name_suffix`` of ``_archive_day``.
|
||||
|
||||
TodayArchiveView
|
||||
----------------
|
||||
|
||||
.. class:: django.views.generic.dates.TodayArchiveView
|
||||
|
||||
A day archive page showing all objects for *today*. This is exactly the
|
||||
|
@ -246,6 +264,10 @@ are views for displaying drilldown pages for date-based data.
|
|||
* :class:`django.views.generic.dates.DateMixin`
|
||||
* :class:`django.views.generic.base.View`
|
||||
|
||||
|
||||
DateDetailView
|
||||
--------------
|
||||
|
||||
.. class:: django.views.generic.dates.DateDetailView
|
||||
|
||||
A page representing an individual object. If the object has a date value in
|
||||
|
|
|
@ -5,6 +5,9 @@ Generic display views
|
|||
The two following generic class-based views are designed to display data. On
|
||||
many projects they are typically the most commonly used views.
|
||||
|
||||
DetailView
|
||||
----------
|
||||
|
||||
.. class:: django.views.generic.detail.DetailView
|
||||
|
||||
While this view is executing, ``self.object`` will contain the object that
|
||||
|
@ -57,6 +60,9 @@ many projects they are typically the most commonly used views.
|
|||
url(r'^(?P<slug>[-_\w]+)/$', ArticleDetailView.as_view(), name='article-detail'),
|
||||
)
|
||||
|
||||
ListView
|
||||
--------
|
||||
|
||||
.. class:: django.views.generic.list.ListView
|
||||
|
||||
A page representing a list of objects.
|
||||
|
|
|
@ -25,6 +25,9 @@ editing content:
|
|||
def get_absolute_url(self):
|
||||
return reverse('author-detail', kwargs={'pk': self.pk})
|
||||
|
||||
FormView
|
||||
--------
|
||||
|
||||
.. class:: django.views.generic.edit.FormView
|
||||
|
||||
A view that displays a form. On error, redisplays the form with validation
|
||||
|
@ -69,6 +72,8 @@ editing content:
|
|||
form.send_email()
|
||||
return super(ContactView, self).form_valid(form)
|
||||
|
||||
CreateView
|
||||
----------
|
||||
|
||||
.. class:: django.views.generic.edit.CreateView
|
||||
|
||||
|
@ -107,6 +112,9 @@ editing content:
|
|||
class AuthorCreate(CreateView):
|
||||
model = Author
|
||||
|
||||
UpdateView
|
||||
----------
|
||||
|
||||
.. class:: django.views.generic.edit.UpdateView
|
||||
|
||||
A view that displays a form for editing an existing object, redisplaying
|
||||
|
@ -146,6 +154,9 @@ editing content:
|
|||
class AuthorUpdate(UpdateView):
|
||||
model = Author
|
||||
|
||||
DeleteView
|
||||
----------
|
||||
|
||||
.. class:: django.views.generic.edit.DeleteView
|
||||
|
||||
A view that displays a confirmation page and deletes an existing object.
|
||||
|
|
|
@ -6,7 +6,7 @@ Class-based views API reference. For introductory material, see
|
|||
:doc:`/topics/class-based-views/index`.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:maxdepth: 3
|
||||
|
||||
base
|
||||
generic-display
|
||||
|
|
|
@ -3,6 +3,9 @@ Date-based mixins
|
|||
=================
|
||||
|
||||
|
||||
YearMixin
|
||||
---------
|
||||
|
||||
.. class:: django.views.generic.dates.YearMixin
|
||||
|
||||
A mixin that can be used to retrieve and provide parsing information for a
|
||||
|
@ -36,6 +39,9 @@ Date-based mixins
|
|||
|
||||
Raises a 404 if no valid year specification can be found.
|
||||
|
||||
MonthMixin
|
||||
----------
|
||||
|
||||
.. class:: django.views.generic.dates.MonthMixin
|
||||
|
||||
A mixin that can be used to retrieve and provide parsing information for a
|
||||
|
@ -82,6 +88,9 @@ Date-based mixins
|
|||
date provided. If ``allow_empty = False``, returns the previous month
|
||||
that contained data.
|
||||
|
||||
DayMixin
|
||||
--------
|
||||
|
||||
.. class:: django.views.generic.dates.DayMixin
|
||||
|
||||
A mixin that can be used to retrieve and provide parsing information for a
|
||||
|
@ -127,6 +136,9 @@ Date-based mixins
|
|||
Returns a date object containing the previous day. If
|
||||
``allow_empty = False``, returns the previous day that contained data.
|
||||
|
||||
WeekMixin
|
||||
---------
|
||||
|
||||
.. class:: django.views.generic.dates.WeekMixin
|
||||
|
||||
A mixin that can be used to retrieve and provide parsing information for a
|
||||
|
@ -161,6 +173,9 @@ Date-based mixins
|
|||
Raises a 404 if no valid week specification can be found.
|
||||
|
||||
|
||||
DateMixin
|
||||
---------
|
||||
|
||||
.. class:: django.views.generic.dates.DateMixin
|
||||
|
||||
A mixin class providing common behavior for all date-based views.
|
||||
|
@ -204,6 +219,9 @@ Date-based mixins
|
|||
is greater than the current date/time. Returns
|
||||
:attr:`DateMixin.allow_future` by default.
|
||||
|
||||
BaseDateListView
|
||||
----------------
|
||||
|
||||
.. class:: django.views.generic.dates.BaseDateListView
|
||||
|
||||
A base class that provides common behavior for all date-based views. There
|
||||
|
|
|
@ -14,6 +14,9 @@ The following mixins are used to construct Django's editing views:
|
|||
Examples of how these are combined into editing views can be found at
|
||||
the documentation on ``Generic editing views``.
|
||||
|
||||
FormMixin
|
||||
---------
|
||||
|
||||
.. class:: django.views.generic.edit.FormMixin
|
||||
|
||||
A mixin class that provides facilities for creating and displaying forms.
|
||||
|
@ -90,6 +93,9 @@ The following mixins are used to construct Django's editing views:
|
|||
:meth:`~django.views.generic.FormMixin.form_invalid`.
|
||||
|
||||
|
||||
ModelFormMixin
|
||||
--------------
|
||||
|
||||
.. class:: django.views.generic.edit.ModelFormMixin
|
||||
|
||||
A form mixin that works on ModelForms, rather than a standalone form.
|
||||
|
@ -148,6 +154,10 @@ The following mixins are used to construct Django's editing views:
|
|||
|
||||
Renders a response, providing the invalid form as context.
|
||||
|
||||
|
||||
ProcessFormView
|
||||
---------------
|
||||
|
||||
.. class:: django.views.generic.edit.ProcessFormView
|
||||
|
||||
A mixin that provides basic HTTP GET and POST workflow.
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
Multiple object mixins
|
||||
======================
|
||||
|
||||
MultipleObjectMixin
|
||||
-------------------
|
||||
|
||||
.. class:: django.views.generic.list.MultipleObjectMixin
|
||||
|
||||
A mixin that can be used to display a list of objects.
|
||||
|
@ -148,6 +151,9 @@ Multiple object mixins
|
|||
this context variable will be ``None``.
|
||||
|
||||
|
||||
MultipleObjectTemplateResponseMixin
|
||||
-----------------------------------
|
||||
|
||||
.. class:: django.views.generic.list.MultipleObjectTemplateResponseMixin
|
||||
|
||||
A mixin class that performs template-based response rendering for views
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
Simple mixins
|
||||
=============
|
||||
|
||||
ContextMixin
|
||||
------------
|
||||
|
||||
.. class:: django.views.generic.base.ContextMixin
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
@ -17,6 +20,9 @@ Simple mixins
|
|||
Returns a dictionary representing the template context. The
|
||||
keyword arguments provided will make up the returned context.
|
||||
|
||||
TemplateResponseMixin
|
||||
---------------------
|
||||
|
||||
.. class:: django.views.generic.base.TemplateResponseMixin
|
||||
|
||||
Provides a mechanism to construct a
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
Single object mixins
|
||||
====================
|
||||
|
||||
SingleObjectMixin
|
||||
-----------------
|
||||
|
||||
.. class:: django.views.generic.detail.SingleObjectMixin
|
||||
|
||||
Provides a mechanism for looking up an object associated with the
|
||||
|
@ -86,6 +89,9 @@ Single object mixins
|
|||
``context_object_name`` is specified, that variable will also be
|
||||
set in the context, with the same value as ``object``.
|
||||
|
||||
SingleObjectTemplateResponseMixin
|
||||
---------------------------------
|
||||
|
||||
.. class:: django.views.generic.detail.SingleObjectTemplateResponseMixin
|
||||
|
||||
A mixin class that performs template-based response rendering for views
|
||||
|
|
Loading…
Reference in New Issue