From 4744e9939b65d168c531e5e23d1ac8a4445ac7f9 Mon Sep 17 00:00:00 2001 From: Matthew Shirley Date: Thu, 23 Oct 2025 11:52:32 -0700 Subject: Fixed #36683 -- Added error message on QuerySet.update() following distinct(*fields). --- tests/distinct_on_fields/tests.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') 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") -- cgit v1.3