mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #30446 -- Defined default output_field of text database functions.
This prevented the default behavior of BaseExpression._resolve_output_field from error'ing out when such functions accepted both expressions from mixed types (e.g. SubStr(CharField, IntegerField, IntegerField)).
This commit is contained in:
committed by
Mariusz Felisiak
parent
0d6d4e78b1
commit
ea3beb4f5a
@@ -1,4 +1,4 @@
|
||||
from django.db.models import CharField, Value
|
||||
from django.db.models import IntegerField, Value
|
||||
from django.db.models.functions import Lower, Right
|
||||
from django.test import TestCase
|
||||
|
||||
@@ -23,5 +23,5 @@ class RightTests(TestCase):
|
||||
Author.objects.annotate(raises=Right('name', 0))
|
||||
|
||||
def test_expressions(self):
|
||||
authors = Author.objects.annotate(name_part=Right('name', Value(3), output_field=CharField()))
|
||||
authors = Author.objects.annotate(name_part=Right('name', Value(3, output_field=IntegerField())))
|
||||
self.assertQuerysetEqual(authors.order_by('name'), ['ith', 'nda'], lambda a: a.name_part)
|
||||
|
||||
Reference in New Issue
Block a user