summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authormgaligniana <marcelogaligniana@gmail.com>2021-11-22 16:30:07 -0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-24 09:28:21 +0100
commit7f8f69fb38247827220805f18c2e0f08406d8a3b (patch)
tree92f8918f0c32e7c2a558f5657dd997dd60b4b1b0 /docs
parentddf321479b0e006bc4efafe57726d54869f38c14 (diff)
Fixed #33298 -- Added docs and tests for using Q objects with get_object_or_404()/get_list_or_404().
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/http/shortcuts.txt14
1 files changed, 10 insertions, 4 deletions
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
index 2fedec5ed4..b5f8fd7617 100644
--- a/docs/topics/http/shortcuts.txt
+++ b/docs/topics/http/shortcuts.txt
@@ -157,8 +157,8 @@ will be returned::
but it raises :class:`~django.http.Http404` instead of the model's
:class:`~django.db.models.Model.DoesNotExist` exception.
-Required arguments
-------------------
+Arguments
+---------
``klass``
A :class:`~django.db.models.Model` class,
@@ -166,6 +166,9 @@ Required arguments
or a :class:`~django.db.models.query.QuerySet` instance from which to get
the object.
+``*args``
+ :class:`Q objects <django.db.models.Q>`.
+
``**kwargs``
Lookup parameters, which should be in the format accepted by ``get()`` and
``filter()``.
@@ -230,14 +233,17 @@ will be raised if more than one object is found.
given model manager cast to a list, raising :class:`~django.http.Http404` if
the resulting list is empty.
-Required arguments
-------------------
+Arguments
+---------
``klass``
A :class:`~django.db.models.Model`, :class:`~django.db.models.Manager` or
:class:`~django.db.models.query.QuerySet` instance from which to get the
list.
+``*args``
+ :class:`Q objects <django.db.models.Q>`.
+
``**kwargs``
Lookup parameters, which should be in the format accepted by ``get()`` and
``filter()``.