mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Added tests for QuerySet.update_or_create() with multi-table inheritance.
This commit is contained in:
committed by
Mariusz Felisiak
parent
67c34c1a37
commit
ae3d575ec3
@@ -12,6 +12,7 @@ from .models import (
|
||||
Author,
|
||||
Book,
|
||||
DefaultPerson,
|
||||
Journalist,
|
||||
ManualPrimaryKeyTest,
|
||||
Person,
|
||||
Profile,
|
||||
@@ -503,6 +504,15 @@ class UpdateOrCreateTests(TestCase):
|
||||
)
|
||||
self.assertFalse(created)
|
||||
|
||||
def test_mti_update_non_local_concrete_fields(self):
|
||||
journalist = Journalist.objects.create(name="Jane", specialty="Politics")
|
||||
journalist, created = Journalist.objects.update_or_create(
|
||||
pk=journalist.pk,
|
||||
defaults={"name": "John"},
|
||||
)
|
||||
self.assertIs(created, False)
|
||||
self.assertEqual(journalist.name, "John")
|
||||
|
||||
|
||||
class UpdateOrCreateTestsWithManualPKs(TestCase):
|
||||
def test_create_with_duplicate_primary_key(self):
|
||||
|
||||
Reference in New Issue
Block a user