mirror of
https://github.com/django/django.git
synced 2025-08-16 00:30:47 +00:00
Fixed #34480 -- Fixed crash of annotations with Chr().
This commit is contained in:
parent
3b4728310a
commit
c3d7a71f83
2 changed files with 12 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
from django.db.models import IntegerField
|
||||
from django.db.models import F, IntegerField
|
||||
from django.db.models.functions import Chr, Left, Ord
|
||||
from django.test import TestCase
|
||||
from django.test.utils import register_lookup
|
||||
|
@ -37,3 +37,13 @@ class ChrTests(TestCase):
|
|||
authors.exclude(name_code_point__chr=Chr(ord("J"))),
|
||||
[self.elena, self.rhonda],
|
||||
)
|
||||
|
||||
def test_annotate(self):
|
||||
authors = Author.objects.annotate(
|
||||
first_initial=Left("name", 1),
|
||||
initial_chr=Chr(ord("J")),
|
||||
)
|
||||
self.assertSequenceEqual(
|
||||
authors.filter(first_initial=F("initial_chr")),
|
||||
[self.john],
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue