diff options
| author | Bryan Marty <bryanmarty@gmail.com> | 2015-10-29 23:24:46 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-12-26 17:57:19 -0500 |
| commit | 62ca2dea04489bdb23df1c7815439287c6d44630 (patch) | |
| tree | eb12cc7fef04d1bce3e1a3f6b1c14124884f6da0 /docs | |
| parent | 2a7ce34600d0f879e93c9a5e02215948ed3bb6ac (diff) | |
Fixed #8065 -- Made id_list an optional argument for QuerySet.in_bulk().
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 11 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index c9c3712669..af307fa47d 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1836,10 +1836,11 @@ database query like ``count()`` would. in_bulk ~~~~~~~ -.. method:: in_bulk(id_list) +.. method:: in_bulk(id_list=None) Takes a list of primary-key values and returns a dictionary mapping each -primary-key value to an instance of the object with the given ID. +primary-key value to an instance of the object with the given ID. If a list +isn't provided, all objects in the queryset are returned. Example:: @@ -1849,9 +1850,15 @@ Example:: {1: <Blog: Beatles Blog>, 2: <Blog: Cheddar Talk>} >>> Blog.objects.in_bulk([]) {} + >>> Blog.objects.in_bulk() + {1: <Blog: Beatles Blog>, 2: <Blog: Cheddar Talk>, 3: <Blog: Django Weblog>} If you pass ``in_bulk()`` an empty list, you'll get an empty dictionary. +.. versionchanged:: 1.10 + + In older versions, ``id_list`` was a required argument. + iterator ~~~~~~~~ diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 077a27cea1..31e15663ba 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -246,6 +246,9 @@ Models :class:`~django.db.models.AutoField` except that it is guaranteed to fit numbers from ``1`` to ``9223372036854775807``. +* :meth:`QuerySet.in_bulk() <django.db.models.query.QuerySet.in_bulk>` + may be called without any arguments to return all objects in the queryset. + Requests and Responses ^^^^^^^^^^^^^^^^^^^^^^ |
