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
|
||||
|
||||
|
||||
class Value(Expression):
|
||||
class Value(SQLiteNumericMixin, Expression):
|
||||
"""Represent a wrapped value as a node within an expression."""
|
||||
# Provide a default value for `for_save` in order to allow unresolved
|
||||
# instances to be compiled until a decision is taken in #25425.
|
||||
|
|
|
@ -1757,6 +1757,11 @@ class ValueTests(TestCase):
|
|||
value = Value('foo', output_field=CharField())
|
||||
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):
|
||||
value_types = [
|
||||
('str', CharField),
|
||||
|
|
Loading…
Reference in New Issue