mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #24485 -- Allowed combined expressions to set output_field
This commit is contained in:
parent
127b3873d0
commit
02a2943e4c
6 changed files with 99 additions and 19 deletions
|
@ -11,8 +11,8 @@ from django.db.models.aggregates import (
|
|||
Avg, Count, Max, Min, StdDev, Sum, Variance,
|
||||
)
|
||||
from django.db.models.expressions import (
|
||||
F, Case, Col, Date, DateTime, Func, OrderBy, Random, RawSQL, Ref, Value,
|
||||
When,
|
||||
F, Case, Col, Date, DateTime, ExpressionWrapper, Func, OrderBy, Random,
|
||||
RawSQL, Ref, Value, When,
|
||||
)
|
||||
from django.db.models.functions import (
|
||||
Coalesce, Concat, Length, Lower, Substr, Upper,
|
||||
|
@ -855,6 +855,10 @@ class ReprTests(TestCase):
|
|||
self.assertEqual(repr(DateTime('published', 'exact', utc)), "DateTime(published, exact, %s)" % utc)
|
||||
self.assertEqual(repr(F('published')), "F(published)")
|
||||
self.assertEqual(repr(F('cost') + F('tax')), "<CombinedExpression: F(cost) + F(tax)>")
|
||||
self.assertEqual(
|
||||
repr(ExpressionWrapper(F('cost') + F('tax'), models.IntegerField())),
|
||||
"ExpressionWrapper(F(cost) + F(tax))"
|
||||
)
|
||||
self.assertEqual(repr(Func('published', function='TO_CHAR')), "Func(F(published), function=TO_CHAR)")
|
||||
self.assertEqual(repr(OrderBy(Value(1))), 'OrderBy(Value(1), descending=False)')
|
||||
self.assertEqual(repr(Random()), "Random()")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue