summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-10-20 00:21:47 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-10-20 00:21:47 +0000
commita014ee02888d2fcea6880bef51f143632a60aab3 (patch)
treeabd57b0f7c11585df0588bb162bcf4aa389cd058 /docs/ref
parent46c17654ed60ee43920406d61eae06a90d15af4d (diff)
Modified the implementation of get_object() to be consistent with the approach used elsewhere in the API. Also added documentation for get_object() which seems to have been accidentally omitted.
This is a BACKWARDS-INCOMPATIBLE CHANGE for anyone depending on the API for get_object() that was introduced (but not documented) in r14254. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14292 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/class-based-views.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/docs/ref/class-based-views.txt b/docs/ref/class-based-views.txt
index ff0d49b013..0158bfec8b 100644
--- a/docs/ref/class-based-views.txt
+++ b/docs/ref/class-based-views.txt
@@ -158,6 +158,19 @@ SingleObjectMixin
Designates the name of the variable to use in the context.
+ .. method:: get_object(queryset=None)
+
+ Returns the single object that this view will display. If
+ ``queryset`` is provided, that queryset will be used as the
+ source of objects; otherwise,
+ :meth:`~SingleObjectMixin.get_queryset` will be used.
+ :meth:`~SingleObjectMixin.get_object` looks for a ``pk``
+ argument in the arguments to the view; if ``pk`` is found,
+ this method performs a primary-key based lookup using that
+ value. If no ``pk`` argument is found, it looks for a ``slug``
+ argument, and performs a slug lookup using the
+ :attr:`SingleObjectMixin.slug_field`.
+
.. method:: get_queryset()
Returns the queryset that will be used to retrieve the object that
@@ -311,7 +324,7 @@ MultipleObjectMixin
objects from that page.
.. method:: get_paginate_by(queryset)
-
+
Returns the number of items to paginate by, or ``None`` for no
pagination. By default this simply returns the value of
:attr:`MultipleObjectMixin.paginate_by`.
@@ -506,7 +519,7 @@ ProcessFormView
A mixin that provides basic HTTP GET and POST workflow.
.. method:: get(request, *args, **kwargs)
-
+
Constructs a form, then renders a response using a context that
contains that form.