1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Refs #36042 -- Raised ValueError when providing composite expressions to aggregates.

This commit is contained in:
Jacob Walls
2025-01-05 10:09:46 -05:00
committed by Sarah Boyce
parent 6eec703667
commit 470e5545e5
8 changed files with 39 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
from django.db.models import Count, Q
from django.db.models import Count, Max, Q
from django.test import TestCase
from .models import Comment, Tenant, User
@@ -136,3 +136,8 @@ class CompositePKAggregateTests(TestCase):
),
(self.user_3, self.user_1, self.user_2),
)
def test_max_pk(self):
msg = "Max does not support composite primary keys."
with self.assertRaisesMessage(ValueError, msg):
Comment.objects.aggregate(Max("pk"))