Ticket #1565: in_bulk-empty-list.diff
File in_bulk-empty-list.diff, 776 bytes (added by , 19 years ago) |
---|
-
django/db/models/query.py
213 213 "Cannot use 'limit' or 'offset' with in_bulk" 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)))) 219 220 qs._params.extend(id_list)