1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #36683 -- Added error message on QuerySet.update() following distinct(*fields).

This commit is contained in:
Matthew Shirley
2025-10-23 11:52:32 -07:00
committed by Jacob Walls
parent 3ff32c50d1
commit 4744e9939b
3 changed files with 9 additions and 0 deletions

View File

@@ -178,3 +178,9 @@ class DistinctOnTests(TestCase):
.order_by("nAmEAlIaS")
)
self.assertSequenceEqual(qs, [self.p1_o1, self.p2_o1, self.p3_o1])
def test_disallowed_update_distinct_on(self):
qs = Staff.objects.distinct("organisation").order_by("organisation")
msg = "Cannot call update() after .distinct(*fields)."
with self.assertRaisesMessage(TypeError, msg):
qs.update(name="p4")