1
0
mirror of https://github.com/django/django.git synced 2025-09-10 02:59:34 +00:00

Refs #36481 -- Improved test coverage for invalid updates on reverse relations.

This commit is contained in:
Ryan P Kilby 2025-09-04 09:24:33 -04:00 committed by Jacob Walls
parent 34bd3ed944
commit 11c2c9ac17

View File

@ -165,6 +165,14 @@ class AdvancedTests(TestCase):
with self.assertRaisesMessage(FieldError, msg):
Bar.objects.update(m2m_foo="whatever")
def test_update_reverse_m2m_descriptor(self):
msg = (
"Cannot update model field <ManyToManyRel: update.bar> "
"(only non-relations and foreign keys permitted)."
)
with self.assertRaisesMessage(FieldError, msg):
Foo.objects.update(m2m_foo="whatever")
def test_update_transformed_field(self):
A.objects.create(x=5)
A.objects.create(x=-6)