1
0
mirror of https://github.com/django/django.git synced 2025-06-08 13:09:13 +00:00

magic-removal: Fixed #1312 -- made QuerySet.in_bulk() accepting of any iterable, not just lists

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-02 04:38:45 +00:00
parent b78f2a9827
commit 124944e5ed

View File

@ -199,7 +199,11 @@ class QuerySet(object):
##################################################
def in_bulk(self, id_list):
assert isinstance(id_list, list), "in_bulk() must be provided with a list of IDs."
try:
iter(id_list)
except TypeError:
assert False, "in_bulk() must be provided with a list of IDs."
id_list = list(id_list)
assert id_list != [], "in_bulk() cannot be passed an empty ID list."
return self._clone(klass=InBulkQuerySet, _id_list=id_list)