mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #29367 -- Fixed model state on objects with a primary key created with QuerySet.bulk_create().
This commit is contained in:
parent
3246ad1065
commit
6d1f576945
2 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue