diff options
author | Oscar Esgalha <oscar@instruct.com.br> | 2018-04-27 14:32:10 -0300 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-04-27 17:57:38 -0400 |
commit | 6d1f5769455ad8e1384087b92aa5839c3540d9ba (patch) | |
tree | f2211df21b9ec6f700f0393134ffe03b04d97e56 /tests/bulk_create | |
parent | 3246ad106517e61437f80e8ef3c9d216754039e7 (diff) | |
download | django-6d1f5769455ad8e1384087b92aa5839c3540d9ba.tar.gz |
Fixed #29367 -- Fixed model state on objects with a primary key created with QuerySet.bulk_create().
Diffstat (limited to 'tests/bulk_create')
-rw-r--r-- | tests/bulk_create/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py index b12ddcaeca..2b3e65594f 100644 --- a/tests/bulk_create/tests.py +++ b/tests/bulk_create/tests.py @@ -252,3 +252,12 @@ class BulkCreateTests(TestCase): # Objects save via bulk_create() and save() should have equal state. self.assertEqual(country_nl._state.adding, country_be._state.adding) self.assertEqual(country_nl._state.db, country_be._state.db) + + def test_set_state_with_pk_specified(self): + state_ca = State(two_letter_code='CA') + state_ny = State(two_letter_code='NY') + State.objects.bulk_create([state_ca]) + state_ny.save() + # Objects save via bulk_create() and save() should have equal state. + self.assertEqual(state_ca._state.adding, state_ny._state.adding) + self.assertEqual(state_ca._state.db, state_ny._state.db) |