0
0
mirror of https://github.com/django/django.git synced 2024-11-29 14:46:18 +01:00

Removed redundant code in QuerySet._batched_insert().

This commit is contained in:
Tim Graham 2016-05-14 06:42:50 -04:00
parent 31501fb53e
commit 3642835bde

View File

@ -1056,15 +1056,13 @@ class QuerySet(object):
inserted_ids = []
for item in [objs[i:i + batch_size] for i in range(0, len(objs), batch_size)]:
if connections[self.db].features.can_return_ids_from_bulk_insert:
inserted_id = self.model._base_manager._insert(
item, fields=fields, using=self.db, return_id=True
)
inserted_id = self._insert(item, fields=fields, using=self.db, return_id=True)
if len(objs) > 1:
inserted_ids.extend(inserted_id)
if len(objs) == 1:
inserted_ids.append(inserted_id)
else:
self.model._base_manager._insert(item, fields=fields, using=self.db)
self._insert(item, fields=fields, using=self.db)
return inserted_ids
def _clone(self, **kwargs):