Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

magic-removal: Fixed #1312 -- made QuerySet.in_bulk() accepting of an…

…y iterable, not just lists

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 124944e5ededdfab22d37ca7f102ff29c44ad112 1 parent b78f2a9
@adrianholovaty adrianholovaty authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/db/models/query.py
View
6 django/db/models/query.py
@@ -199,7 +199,11 @@ def delete(self, *args, **kwargs):
##################################################
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)
Please sign in to comment.
Something went wrong with that request. Please try again.