mirror of
https://github.com/django/django.git
synced 2025-06-08 04:59:13 +00:00
magic-removal: Changed QuerySet.in_bulk() to check for tuple or list, because it was accepting strings, which are iterable.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c060e85c8d
commit
bd5b9412b3
@ -195,10 +195,7 @@ class QuerySet(object):
|
|||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
def in_bulk(self, id_list):
|
def in_bulk(self, id_list):
|
||||||
try:
|
assert isinstance(id_list, (tuple, list)), "in_bulk() must be provided with a list of IDs."
|
||||||
iter(id_list)
|
|
||||||
except TypeError:
|
|
||||||
assert False, "in_bulk() must be provided with a list of IDs."
|
|
||||||
id_list = list(id_list)
|
id_list = list(id_list)
|
||||||
assert id_list != [], "in_bulk() cannot be passed an empty ID list."
|
assert id_list != [], "in_bulk() cannot be passed an empty ID list."
|
||||||
return self._clone(klass=InBulkQuerySet, _id_list=id_list)
|
return self._clone(klass=InBulkQuerySet, _id_list=id_list)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user