mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #32585 -- Fixed Value() crash with DecimalField on SQLite.
This commit is contained in:
parent
dcb06c2c68
commit
ed0cc52dc3
@ -707,7 +707,7 @@ class Func(SQLiteNumericMixin, Expression):
|
|||||||
return copy
|
return copy
|
||||||
|
|
||||||
|
|
||||||
class Value(Expression):
|
class Value(SQLiteNumericMixin, Expression):
|
||||||
"""Represent a wrapped value as a node within an expression."""
|
"""Represent a wrapped value as a node within an expression."""
|
||||||
# Provide a default value for `for_save` in order to allow unresolved
|
# Provide a default value for `for_save` in order to allow unresolved
|
||||||
# instances to be compiled until a decision is taken in #25425.
|
# instances to be compiled until a decision is taken in #25425.
|
||||||
|
@ -1757,6 +1757,11 @@ class ValueTests(TestCase):
|
|||||||
value = Value('foo', output_field=CharField())
|
value = Value('foo', output_field=CharField())
|
||||||
self.assertEqual(value.as_sql(compiler, connection), ('%s', ['foo']))
|
self.assertEqual(value.as_sql(compiler, connection), ('%s', ['foo']))
|
||||||
|
|
||||||
|
def test_output_field_decimalfield(self):
|
||||||
|
Time.objects.create()
|
||||||
|
time = Time.objects.annotate(one=Value(1, output_field=DecimalField())).first()
|
||||||
|
self.assertEqual(time.one, 1)
|
||||||
|
|
||||||
def test_resolve_output_field(self):
|
def test_resolve_output_field(self):
|
||||||
value_types = [
|
value_types = [
|
||||||
('str', CharField),
|
('str', CharField),
|
||||||
|
Loading…
Reference in New Issue
Block a user