Changeset 2663
- Timestamp:
- 04/10/06 22:15:22 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/django/db/models/query.py
r2613 r2663 214 214 assert isinstance(id_list, (tuple, list)), "in_bulk() must be provided with a list of IDs." 215 215 id_list = list(id_list) 216 assert id_list != [], "in_bulk() cannot be passed an empty ID list." 216 if id_list == []: 217 return {} 217 218 qs = self._clone() 218 219 qs._where.append("%s.%s IN (%s)" % (backend.quote_name(self.model._meta.db_table), backend.quote_name(self.model._meta.pk.column), ",".join(['%s'] * len(id_list)))) django/branches/magic-removal/tests/modeltests/lookup/models.py
r2430 r2663 68 68 {} 69 69 >>> Article.objects.in_bulk([]) 70 Traceback (most recent call last): 71 ... 72 AssertionError: in_bulk() cannot be passed an empty ID list. 70 {} 73 71 >>> Article.objects.in_bulk('foo') 74 72 Traceback (most recent call last):
