summaryrefslogtreecommitdiff
path: root/tests/distinct_on_fields
diff options
context:
space:
mode:
authorMatthew Shirley <matt@greenspacehealth.com>2025-10-23 11:52:32 -0700
committerJacob Walls <jacobtylerwalls@gmail.com>2025-10-25 12:21:27 -0400
commit4744e9939b65d168c531e5e23d1ac8a4445ac7f9 (patch)
treee81440ae873d0dfa80aef5662af2ef6c9a12020e /tests/distinct_on_fields
parent3ff32c50d143d8a498f9a5dfef1a31b16a7456fe (diff)
Fixed #36683 -- Added error message on QuerySet.update() following distinct(*fields).
Diffstat (limited to 'tests/distinct_on_fields')
-rw-r--r--tests/distinct_on_fields/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/distinct_on_fields/tests.py b/tests/distinct_on_fields/tests.py
index 93b3f27aec..f03e05ac73 100644
--- a/tests/distinct_on_fields/tests.py
+++ b/tests/distinct_on_fields/tests.py
@@ -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")