Ticket #12251: 12251.queryset_in_bulk_set.diff
File 12251.queryset_in_bulk_set.diff, 1.1 KB (added by , 15 years ago) |
---|
-
tests/modeltests/lookup/models.py
102 102 <Article: Article 2> 103 103 >>> Article.objects.in_bulk([3]) 104 104 {3: <Article: Article 3>} 105 >>> Article.objects.in_bulk(set([3])) 106 {3: <Article: Article 3>} 107 >>> Article.objects.in_bulk(frozenset([3])) 108 {3: <Article: Article 3>} 109 >>> Article.objects.in_bulk((3,)) 110 {3: <Article: Article 3>} 105 111 >>> Article.objects.in_bulk([1000]) 106 112 {} 107 113 >>> Article.objects.in_bulk([]) -
django/db/models/query.py
356 356 """ 357 357 assert self.query.can_filter(), \ 358 358 "Cannot use 'limit' or 'offset' with in_bulk" 359 assert isinstance(id_list, (tuple, list)), \359 assert isinstance(id_list, (tuple, list, set, frozenset)), \ 360 360 "in_bulk() must be provided with a list of IDs." 361 361 if not id_list: 362 362 return {}