1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #33308 -- Improved adapting DecimalField values to decimal.

This commit is contained in:
Florian Apolloner 2022-11-07 19:34:08 +01:00 committed by GitHub
parent 5f09ab8c30
commit 7990d254b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1721,9 +1721,11 @@ class DecimalField(Field):
)
return decimal_value
def get_db_prep_save(self, value, connection):
def get_db_prep_value(self, value, connection, prepared=False):
if not prepared:
value = self.get_prep_value(value)
return connection.ops.adapt_decimalfield_value(
self.to_python(value), self.max_digits, self.decimal_places
value, self.max_digits, self.decimal_places
)
def get_prep_value(self, value):