summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-11-03 16:28:04 +0100
committerGitHub <noreply@github.com>2023-11-03 16:28:04 +0100
commit656192c2c96bb955a399d92f381e38fe2254fe17 (patch)
treefe74d85903fa7dcb61312bb0dd822ae41477d59d
parent7a09ba0962e0eaf4ad396475b392ba3234bf60ee (diff)
Fixed #34941 -- Fixed fetching decimal db_defaults for DecimalFields on Oracle.
This is a long standing bug in bc91f27a86090b4c688b56cd4e37f95eebe6e969 that began manifesting in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
-rw-r--r--django/db/backends/oracle/features.py6
-rw-r--r--django/db/backends/oracle/utils.py3
2 files changed, 2 insertions, 7 deletions
diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py
index de00a468dd..dfec605c1b 100644
--- a/django/db/backends/oracle/features.py
+++ b/django/db/backends/oracle/features.py
@@ -119,12 +119,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
"Oracle doesn't support comparing NCLOB to NUMBER.": {
"generic_relations_regress.tests.GenericRelationTests.test_textlink_filter",
},
- "DecimalField.db_default doesn't return decimal.Decimal instances on Oracle "
- "(#34941).": {
- "field_defaults.tests.DefaultTests.test_field_db_defaults_returning",
- "migrations.test_operations.OperationTests."
- "test_alter_field_change_nullable_to_decimal_database_default_not_null",
- },
}
django_test_expected_failures = {
# A bug in Django/oracledb with respect to string handling (#23843).
diff --git a/django/db/backends/oracle/utils.py b/django/db/backends/oracle/utils.py
index 318a265645..930b8e0918 100644
--- a/django/db/backends/oracle/utils.py
+++ b/django/db/backends/oracle/utils.py
@@ -1,4 +1,5 @@
import datetime
+import decimal
from .base import Database
@@ -23,7 +24,7 @@ class InsertVar:
"FloatField": Database.NATIVE_FLOAT,
"DateTimeField": Database.TIMESTAMP,
"DateField": Database.Date,
- "DecimalField": Database.NUMBER,
+ "DecimalField": decimal.Decimal,
}
def __init__(self, field):