From 62ca2dea04489bdb23df1c7815439287c6d44630 Mon Sep 17 00:00:00 2001 From: Bryan Marty Date: Thu, 29 Oct 2015 23:24:46 -0700 Subject: Fixed #8065 -- Made id_list an optional argument for QuerySet.in_bulk(). --- docs/ref/models/querysets.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'docs/ref') 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: , 2: } >>> Blog.objects.in_bulk([]) {} + >>> Blog.objects.in_bulk() + {1: , 2: , 3: } 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 ~~~~~~~~ -- cgit v1.3