Author: Alex
Date: 2011-09-10 14:44:57 -0700 (Sat, 10 Sep 2011)
New Revision: 16791

Modified:
   django/trunk/django/db/models/query.py
   django/trunk/tests/regressiontests/bulk_create/tests.py
Log:
Ensure bulk_create returns what it is supposed to.

Modified: django/trunk/django/db/models/query.py
===================================================================
--- django/trunk/django/db/models/query.py      2011-09-10 21:29:21 UTC (rev 
16790)
+++ django/trunk/django/db/models/query.py      2011-09-10 21:44:57 UTC (rev 
16791)
@@ -388,6 +388,7 @@
                 self.model._base_manager._insert(objs_with_pk, fields=fields, 
using=self.db)
             if objs_without_pk:
                 self.model._base_manager._insert(objs_without_pk, fields=[f 
for f in fields if not isinstance(f, AutoField)], using=self.db)
+        return objs
 
     def get_or_create(self, **kwargs):
         """

Modified: django/trunk/tests/regressiontests/bulk_create/tests.py
===================================================================
--- django/trunk/tests/regressiontests/bulk_create/tests.py     2011-09-10 
21:29:21 UTC (rev 16790)
+++ django/trunk/tests/regressiontests/bulk_create/tests.py     2011-09-10 
21:44:57 UTC (rev 16791)
@@ -17,7 +17,8 @@
         ]
 
     def test_simple(self):
-        Country.objects.bulk_create(self.data)
+        created = Country.objects.bulk_create(self.data)
+        self.assertEqual(len(created), 4)
         self.assertQuerysetEqual(Country.objects.order_by("-name"), [
             "United States of America", "The Netherlands", "Germany", "Czech 
Republic"
         ], attrgetter("name"))

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to