mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Refs #36075 -- Adjusted MTI handling of _non_pk_concrete_field_names.
Regression in bf7b17d16d.
Thanks Sage Abdullah for the report.
This commit is contained in:
committed by
Sarah Boyce
parent
161e79d277
commit
f07360e808
@@ -7,8 +7,8 @@ from .models import Account, Employee, Person, Profile, ProxyEmployee
|
||||
|
||||
class UpdateOnlyFieldsTests(TestCase):
|
||||
msg = (
|
||||
"The following fields do not exist in this model, are m2m fields, or "
|
||||
"are non-concrete fields: %s"
|
||||
"The following fields do not exist in this model, are m2m "
|
||||
"fields, primary keys, or are non-concrete fields: %s"
|
||||
)
|
||||
|
||||
def test_update_fields_basic(self):
|
||||
@@ -308,3 +308,13 @@ class UpdateOnlyFieldsTests(TestCase):
|
||||
profile_boss = Profile.objects.create(name="Boss", salary=3000)
|
||||
with self.assertRaisesMessage(ValueError, self.msg % "non_concrete"):
|
||||
profile_boss.save(update_fields=["non_concrete"])
|
||||
|
||||
def test_update_pk_field(self):
|
||||
person_boss = Person.objects.create(name="Boss", gender="F")
|
||||
with self.assertRaisesMessage(ValueError, self.msg % "id"):
|
||||
person_boss.save(update_fields=["id"])
|
||||
|
||||
def test_update_inherited_pk_field(self):
|
||||
employee_boss = Employee.objects.create(name="Boss", gender="F")
|
||||
with self.assertRaisesMessage(ValueError, self.msg % "id"):
|
||||
employee_boss.save(update_fields=["id"])
|
||||
|
||||
Reference in New Issue
Block a user