Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure bulk_create returns the right value if the argument is an empt…

…y list.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b45a4acf6f29025f28baf524809f34a14b7ccde7 1 parent f2bc919
@alex alex authored
2  django/db/models/
@@ -372,7 +372,7 @@ def bulk_create(self, objs):
if self.model._meta.parents:
raise ValueError("Can't bulk create an inherited model")
if not objs:
- return
+ return objs
self._for_write = True
connection = connections[self.db]
fields = self.model._meta.local_fields
4 tests/regressiontests/bulk_create/
@@ -23,6 +23,10 @@ def test_simple(self):
"United States of America", "The Netherlands", "Germany", "Czech Republic"
], attrgetter("name"))
+ created = Country.objects.bulk_create([])
+ self.assertEqual(created, [])
+ self.assertEqual(Country.objects.count(), 4)
def test_efficiency(self):
with self.assertNumQueries(1):
Please sign in to comment.
Something went wrong with that request. Please try again.