Stopped adapting DecimalField values to strings on PostgreSQL.
The psycopg2 backend uses the type information to provide type hints.
This commit is contained in:
parent
f783a99072
commit
9c5c9bd709
|
@ -257,6 +257,9 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||||
def adapt_timefield_value(self, value):
|
def adapt_timefield_value(self, value):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def adapt_decimalfield_value(self, value, max_digits=None, decimal_places=None):
|
||||||
|
return value
|
||||||
|
|
||||||
def adapt_ipaddressfield_value(self, value):
|
def adapt_ipaddressfield_value(self, value):
|
||||||
if value:
|
if value:
|
||||||
return Inet(value)
|
return Inet(value)
|
||||||
|
|
|
@ -6,9 +6,9 @@ from uuid import UUID
|
||||||
|
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError
|
||||||
from django.db.models import (
|
from django.db.models import (
|
||||||
BinaryField, BooleanField, Case, CharField, Count, DurationField, F,
|
BinaryField, BooleanField, Case, CharField, Count, DecimalField,
|
||||||
GenericIPAddressField, IntegerField, Max, Min, Q, Sum, TextField,
|
DurationField, F, GenericIPAddressField, IntegerField, Max, Min, Q, Sum,
|
||||||
TimeField, UUIDField, Value, When,
|
TextField, TimeField, UUIDField, Value, When,
|
||||||
)
|
)
|
||||||
from django.test import SimpleTestCase, TestCase
|
from django.test import SimpleTestCase, TestCase
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ class CaseExpressionTests(TestCase):
|
||||||
CaseTestModel.objects.update(
|
CaseTestModel.objects.update(
|
||||||
decimal=Case(
|
decimal=Case(
|
||||||
When(integer=1, then=Decimal('1.1')),
|
When(integer=1, then=Decimal('1.1')),
|
||||||
When(integer=2, then=Decimal('2.2')),
|
When(integer=2, then=Value(Decimal('2.2'), output_field=DecimalField())),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
|
|
Loading…
Reference in New Issue