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

Refs #35982 -- Made BaseDatabaseOperations.adapt_decimalfield_value() a no-op.

This commit is contained in:
Simon Charette 2024-12-07 10:07:55 -05:00 committed by Sarah Boyce
parent a0db341c3c
commit b0b3024720
5 changed files with 3 additions and 11 deletions

View File

@ -8,7 +8,6 @@ import sqlparse
from django.conf import settings from django.conf import settings
from django.db import NotSupportedError, transaction from django.db import NotSupportedError, transaction
from django.db.backends import utils
from django.db.models.expressions import Col from django.db.models.expressions import Col
from django.utils import timezone from django.utils import timezone
from django.utils.deprecation import RemovedInDjango60Warning from django.utils.deprecation import RemovedInDjango60Warning
@ -586,7 +585,7 @@ class BaseDatabaseOperations:
Transform a decimal.Decimal value to an object compatible with what is Transform a decimal.Decimal value to an object compatible with what is
expected by the backend driver for decimal (numeric) columns. expected by the backend driver for decimal (numeric) columns.
""" """
return utils.format_number(value, max_digits, decimal_places) return value
def adapt_ipaddressfield_value(self, value): def adapt_ipaddressfield_value(self, value):
""" """

View File

@ -166,9 +166,6 @@ class DatabaseOperations(BaseDatabaseOperations):
""" """
return [(None, ("NULL", [], False))] return [(None, ("NULL", [], False))]
def adapt_decimalfield_value(self, value, max_digits=None, decimal_places=None):
return value
def last_executed_query(self, cursor, sql, params): def last_executed_query(self, cursor, sql, params):
# With MySQLdb, cursor objects have an (undocumented) "_executed" # With MySQLdb, cursor objects have an (undocumented) "_executed"
# attribute where the exact query sent to the database is saved. # attribute where the exact query sent to the database is saved.

View File

@ -629,9 +629,6 @@ END;
1900, 1, 1, value.hour, value.minute, value.second, value.microsecond 1900, 1, 1, value.hour, value.minute, value.second, value.microsecond
) )
def adapt_decimalfield_value(self, value, max_digits=None, decimal_places=None):
return value
def combine_expression(self, connector, sub_expressions): def combine_expression(self, connector, sub_expressions):
lhs, rhs = sub_expressions lhs, rhs = sub_expressions
if connector == "%%": if connector == "%%":

View File

@ -346,9 +346,6 @@ 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)

View File

@ -399,6 +399,8 @@ backends.
* The new :meth:`Model._is_pk_set() <django.db.models.Model._is_pk_set>` method * The new :meth:`Model._is_pk_set() <django.db.models.Model._is_pk_set>` method
allows checking if a Model instance's primary key is defined. allows checking if a Model instance's primary key is defined.
* ``BaseDatabaseOperations.adapt_decimalfield_value()`` is now a no-op, simply
returning the given value.
:mod:`django.contrib.gis` :mod:`django.contrib.gis`
------------------------- -------------------------