diff --git a/django/db/models/query.py b/django/db/models/query.py index 324554eb785..0fc48f8a41c 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -413,8 +413,6 @@ class QuerySet(object): """ assert self.query.can_filter(), \ "Cannot use 'limit' or 'offset' with in_bulk" - assert isinstance(id_list, (tuple, list, set, frozenset)), \ - "in_bulk() must be provided with a list of IDs." if not id_list: return {} qs = self._clone() diff --git a/tests/modeltests/lookup/tests.py b/tests/modeltests/lookup/tests.py index cf18a83945a..3f40bf10f53 100644 --- a/tests/modeltests/lookup/tests.py +++ b/tests/modeltests/lookup/tests.py @@ -115,7 +115,8 @@ class LookupTests(TestCase): self.assertEqual(Article.objects.in_bulk((self.a3.id,)), {self.a3.id: self.a3}) self.assertEqual(Article.objects.in_bulk([1000]), {}) self.assertEqual(Article.objects.in_bulk([]), {}) - self.assertRaises(AssertionError, Article.objects.in_bulk, 'foo') + self.assertEqual(Article.objects.in_bulk(iter([self.a1.id])), {self.a1.id: self.a1}) + self.assertEqual(Article.objects.in_bulk(iter([])), {}) self.assertRaises(TypeError, Article.objects.in_bulk) self.assertRaises(TypeError, Article.objects.in_bulk, headline__startswith='Blah')