1
0
mirror of https://github.com/django/django.git synced 2025-01-12 03:15:47 +00:00

Cleaned up the implementation of in_bulk

This commit is contained in:
Alex Gaynor 2012-08-24 16:08:16 -07:00 committed by Alex Gaynor
parent e57338f2b9
commit b7c3b044fc

View File

@ -498,9 +498,7 @@ class QuerySet(object):
"Cannot use 'limit' or 'offset' with in_bulk"
if not id_list:
return {}
qs = self._clone()
qs.query.add_filter(('pk__in', id_list))
qs.query.clear_ordering(force_empty=True)
qs = self.filter(pk__in=id_list).order_by()
return dict([(obj._get_pk_val(), obj) for obj in qs])
def delete(self):