Skip to content

Commit

Permalink
Refs #35982 -- Made BaseDatabaseOperations.adapt_decimalfield_value()…
Browse files Browse the repository at this point in the history
… a no-op.
  • Loading branch information
charettes authored and sarahboyce committed Dec 9, 2024
1 parent a0db341 commit b0b3024
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions django/db/backends/base/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from django.conf import settings
from django.db import NotSupportedError, transaction
from django.db.backends import utils
from django.db.models.expressions import Col
from django.utils import timezone
from django.utils.deprecation import RemovedInDjango60Warning
Expand Down Expand Up @@ -586,7 +585,7 @@ def adapt_decimalfield_value(self, value, max_digits=None, decimal_places=None):
Transform a decimal.Decimal value to an object compatible with what is
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):
"""
Expand Down
3 changes: 0 additions & 3 deletions django/db/backends/mysql/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ def force_no_ordering(self):
"""
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):
# With MySQLdb, cursor objects have an (undocumented) "_executed"
# attribute where the exact query sent to the database is saved.
Expand Down
3 changes: 0 additions & 3 deletions django/db/backends/oracle/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,6 @@ def adapt_timefield_value(self, value):
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):
lhs, rhs = sub_expressions
if connector == "%%":
Expand Down
3 changes: 0 additions & 3 deletions django/db/backends/postgresql/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ def adapt_datetimefield_value(self, value):
def adapt_timefield_value(self, value):
return value

def adapt_decimalfield_value(self, value, max_digits=None, decimal_places=None):
return value

def adapt_ipaddressfield_value(self, value):
if value:
return Inet(value)
Expand Down
2 changes: 2 additions & 0 deletions docs/releases/5.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ backends.
* 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.

* ``BaseDatabaseOperations.adapt_decimalfield_value()`` is now a no-op, simply
returning the given value.

:mod:`django.contrib.gis`
-------------------------
Expand Down

0 comments on commit b0b3024

Please sign in to comment.