mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #33309 -- Fixed QuerySet.distinct() crash on mixed case annotation.
This commit is contained in:
committed by
Mariusz Felisiak
parent
aec71aaa5b
commit
bdcda1ca9b
@@ -1,5 +1,5 @@
|
||||
from django.db import connection
|
||||
from django.db.models import CharField, Max
|
||||
from django.db.models import CharField, F, Max
|
||||
from django.db.models.functions import Lower
|
||||
from django.test import TestCase, skipUnlessDBFeature
|
||||
from django.test.utils import register_lookup
|
||||
@@ -149,3 +149,9 @@ class DistinctOnTests(TestCase):
|
||||
"""
|
||||
staff = Staff.objects.distinct('name').order_by('name', '-organisation').get(name='p1')
|
||||
self.assertEqual(staff.organisation, 'o2')
|
||||
|
||||
def test_distinct_on_mixed_case_annotation(self):
|
||||
qs = Staff.objects.annotate(
|
||||
nAmEAlIaS=F('name'),
|
||||
).distinct('nAmEAlIaS').order_by('nAmEAlIaS')
|
||||
self.assertSequenceEqual(qs, [self.p1_o1, self.p2_o1, self.p3_o1])
|
||||
|
||||
Reference in New Issue
Block a user