summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnubhav Joshi <anubhav9042@gmail.com>2014-06-20 10:30:04 +0530
committerShai Berger <shai@platonix.com>2014-06-23 19:36:40 +0300
commit1c50d6ae2bee31ccf605066186d4d48aaf2de7ea (patch)
tree492056ff2f0f55d38494bd4623e494a77da554fb
parent908160f6926506dc64244e9d5a4507bc67ea0a81 (diff)
Fixed problem introduced with #refs 13711.
-rw-r--r--django/db/backends/__init__.py4
-rw-r--r--django/db/backends/oracle/base.py1
-rw-r--r--django/db/models/base.py2
-rw-r--r--tests/invalid_models_tests/test_models.py2
4 files changed, 7 insertions, 2 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 8acfde014c..a7252cf57d 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -520,6 +520,10 @@ class BaseDatabaseFeatures(object):
# at the end of each save operation?
supports_forward_references = True
+ # Does the backend uses proper method like 'truncate_name'
+ # to auto-truncate column names?
+ truncates_name = False
+
# Is there a REAL datatype in addition to floats/doubles?
has_real_datatype = False
supports_subqueries_in_group_by = True
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 8bd7f04086..3f596ef425 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -107,6 +107,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_bitwise_or = False
can_defer_constraint_checks = True
supports_partially_nullable_unique_constraints = False
+ truncates_name = True
has_bulk_insert = True
supports_tablespaces = True
supports_sequence_reset = False
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 74bece1f5c..6c59c0038a 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1469,7 +1469,7 @@ class Model(six.with_metaclass(ModelBase)):
continue
connection = connections[db]
max_name_length = connection.ops.max_name_length()
- if max_name_length is None:
+ if max_name_length is None or connection.features.truncates_name:
continue
else:
if allowed_len is None:
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 8550dc3065..6bce3f9a26 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -18,7 +18,7 @@ def get_max_column_name_length():
for db in settings.DATABASES.keys():
connection = connections[db]
max_name_length = connection.ops.max_name_length()
- if max_name_length is None:
+ if max_name_length is None or connection.features.truncates_name:
continue
else:
if allowed_len is None: