mirror of https://github.com/django/django.git
[1.6.x] Fixed inaccuracies in generic mixins documentation.
Backport of a5391db76a
from master.
This commit is contained in:
parent
63d6983746
commit
dbb9819360
|
@ -111,6 +111,12 @@ CreateView
|
||||||
creating objects for the example ``Author`` model would cause the
|
creating objects for the example ``Author`` model would cause the
|
||||||
default ``template_name`` to be ``'myapp/author_create_form.html'``.
|
default ``template_name`` to be ``'myapp/author_create_form.html'``.
|
||||||
|
|
||||||
|
.. attribute:: object
|
||||||
|
|
||||||
|
When using ``CreateView`` you have access to ``self.object``, which is
|
||||||
|
the object being created. If the object hasn't been created yet, the
|
||||||
|
value will be ``None``.
|
||||||
|
|
||||||
**Example myapp/views.py**::
|
**Example myapp/views.py**::
|
||||||
|
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic.edit import CreateView
|
||||||
|
@ -162,6 +168,11 @@ UpdateView
|
||||||
updating objects for the example ``Author`` model would cause the
|
updating objects for the example ``Author`` model would cause the
|
||||||
default ``template_name`` to be ``'myapp/author_update_form.html'``.
|
default ``template_name`` to be ``'myapp/author_update_form.html'``.
|
||||||
|
|
||||||
|
.. attribute:: object
|
||||||
|
|
||||||
|
When using ``UpdateView`` you have access to ``self.object``, which is
|
||||||
|
the object being updated.
|
||||||
|
|
||||||
**Example myapp/views.py**::
|
**Example myapp/views.py**::
|
||||||
|
|
||||||
from django.views.generic.edit import UpdateView
|
from django.views.generic.edit import UpdateView
|
||||||
|
|
|
@ -12,7 +12,7 @@ The following mixins are used to construct Django's editing views:
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Examples of how these are combined into editing views can be found at
|
Examples of how these are combined into editing views can be found at
|
||||||
the documentation on ``Generic editing views``.
|
the documentation on :doc:`/ref/class-based-views/generic-editing`.
|
||||||
|
|
||||||
FormMixin
|
FormMixin
|
||||||
---------
|
---------
|
||||||
|
@ -112,9 +112,7 @@ ModelFormMixin
|
||||||
mixin have access to the
|
mixin have access to the
|
||||||
:attr:`~django.views.generic.detail.SingleObjectMixin.model` and
|
:attr:`~django.views.generic.detail.SingleObjectMixin.model` and
|
||||||
:attr:`~django.views.generic.detail.SingleObjectMixin.queryset` attributes,
|
:attr:`~django.views.generic.detail.SingleObjectMixin.queryset` attributes,
|
||||||
describing the type of object that the ``ModelForm`` is manipulating. The
|
describing the type of object that the ``ModelForm`` is manipulating.
|
||||||
view also provides ``self.object``, the instance being manipulated. If the
|
|
||||||
instance is being created, ``self.object`` will be ``None``.
|
|
||||||
|
|
||||||
**Mixins**
|
**Mixins**
|
||||||
|
|
||||||
|
@ -218,6 +216,10 @@ ProcessFormView
|
||||||
The ``PUT`` action is also handled and just passes all parameters
|
The ``PUT`` action is also handled and just passes all parameters
|
||||||
through to :meth:`post`.
|
through to :meth:`post`.
|
||||||
|
|
||||||
|
|
||||||
|
DeletionMixin
|
||||||
|
-------------
|
||||||
|
|
||||||
.. class:: django.views.generic.edit.DeletionMixin
|
.. class:: django.views.generic.edit.DeletionMixin
|
||||||
|
|
||||||
Enables handling of the ``DELETE`` http action.
|
Enables handling of the ``DELETE`` http action.
|
||||||
|
|
Loading…
Reference in New Issue