Fixed #31003 -- Doc'd and tested return value of QuerySet.bulk_create().
This commit is contained in:
parent
7e8339748c
commit
382af9b141
|
@ -2100,6 +2100,8 @@ that fail constraints such as duplicate unique values. Enabling this parameter
|
||||||
disables setting the primary key on each model instance (if the database
|
disables setting the primary key on each model instance (if the database
|
||||||
normally supports it).
|
normally supports it).
|
||||||
|
|
||||||
|
Returns ``objs`` as cast to a list, in the same order as provided.
|
||||||
|
|
||||||
``bulk_update()``
|
``bulk_update()``
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class BulkCreateTests(TestCase):
|
||||||
|
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
created = Country.objects.bulk_create(self.data)
|
created = Country.objects.bulk_create(self.data)
|
||||||
self.assertEqual(len(created), 4)
|
self.assertEqual(created, self.data)
|
||||||
self.assertQuerysetEqual(Country.objects.order_by("-name"), [
|
self.assertQuerysetEqual(Country.objects.order_by("-name"), [
|
||||||
"United States of America", "The Netherlands", "Germany", "Czech Republic"
|
"United States of America", "The Netherlands", "Germany", "Czech Republic"
|
||||||
], attrgetter("name"))
|
], attrgetter("name"))
|
||||||
|
|
Loading…
Reference in New Issue