Refs #27859 -- Added DatabaseWrapper.display_name.
Thanks Tim Graham for the review.
This commit is contained in:
parent
5dc6f77423
commit
b3eb6eaf1a
|
@ -31,6 +31,7 @@ class BaseDatabaseWrapper:
|
|||
data_type_check_constraints = {}
|
||||
ops = None
|
||||
vendor = 'unknown'
|
||||
display_name = 'unknown'
|
||||
SchemaEditorClass = None
|
||||
# Classes instantiated in __init__().
|
||||
client_class = None
|
||||
|
|
|
@ -103,6 +103,7 @@ class CursorWrapper:
|
|||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
vendor = 'mysql'
|
||||
display_name = 'MySQL'
|
||||
# This dictionary maps Field objects to their associated MySQL column
|
||||
# types, as strings. Column-type strings can contain format strings; they'll
|
||||
# be interpolated against the values of Field.__dict__ before being output.
|
||||
|
|
|
@ -72,6 +72,7 @@ class _UninitializedOperatorsDescriptor:
|
|||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
vendor = 'oracle'
|
||||
display_name = 'Oracle'
|
||||
# This dictionary maps Field objects to their associated Oracle column
|
||||
# types, as strings. Column-type strings can contain format strings; they'll
|
||||
# be interpolated against the values of Field.__dict__ before being output.
|
||||
|
|
|
@ -59,6 +59,7 @@ psycopg2.extensions.register_type(INETARRAY)
|
|||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
vendor = 'postgresql'
|
||||
display_name = 'PostgreSQL'
|
||||
# This dictionary maps Field objects to their associated PostgreSQL column
|
||||
# types, as strings. Column-type strings can contain format strings; they'll
|
||||
# be interpolated against the values of Field.__dict__ before being output.
|
||||
|
|
|
@ -45,6 +45,7 @@ Database.register_adapter(decimal.Decimal, backend_utils.rev_typecast_decimal)
|
|||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
vendor = 'sqlite'
|
||||
display_name = 'SQLite'
|
||||
# SQLite doesn't actually support most of these types, but it "does the right
|
||||
# thing" given more verbose field definitions, so leave them as is so that
|
||||
# schema inspection is more useful.
|
||||
|
|
|
@ -258,6 +258,10 @@ Database backend API
|
|||
``datetime_extract_sql()`` methods now return only the SQL to perform the
|
||||
operation instead of SQL and a list of parameters.
|
||||
|
||||
* Third-party database backends should add a ``DatabaseWrapper.display_name``
|
||||
attribute with the name of the database that your backend works with. Django
|
||||
may use it in various messages, such as in system checks.
|
||||
|
||||
Dropped support for Oracle 11.2
|
||||
-------------------------------
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@ class DatabaseWrapperTests(SimpleTestCase):
|
|||
instance_attr_value = getattr(conn, instance_attr_name)
|
||||
self.assertIsInstance(instance_attr_value, class_attr_value)
|
||||
|
||||
def test_initialization_display_name(self):
|
||||
self.assertEqual(BaseDatabaseWrapper.display_name, 'unknown')
|
||||
self.assertNotEqual(connection.display_name, 'unknown')
|
||||
|
||||
|
||||
class DummyBackendTest(SimpleTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue