diff options
| author | Shai Berger <shai@platonix.com> | 2014-09-27 00:18:22 +0300 |
|---|---|---|
| committer | Shai Berger <shai@platonix.com> | 2014-09-27 09:49:50 +0300 |
| commit | c1ae0621bab6b013025ec9024691ce7ad556409e (patch) | |
| tree | df1c2d71bae8fe23c00af16715fd3a9ebe332860 /django/db/backends/__init__.py | |
| parent | dbdae3a75512bddbf0b75ea6354fb3fc4bdb53cf (diff) | |
Fixed #22738 -- made finer distinctions for when Boolean is not detected on Oracle
Thanks Claude Paroz for partial fix and Simon Charrette for review
Diffstat (limited to 'django/db/backends/__init__.py')
| -rw-r--r-- | django/db/backends/__init__.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 8bdf6eed3c..ce3ea04d98 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -614,9 +614,6 @@ class BaseDatabaseFeatures(object): # Can the backend introspect an BinaryField, instead of an TextField? can_introspect_binary_field = True - # What is the type returned when the backend introspect a BooleanField? - introspected_boolean_field_type = 'BooleanField' - # Can the backend introspect an DecimalField, instead of an FloatField? can_introspect_decimal_field = True @@ -715,6 +712,23 @@ class BaseDatabaseFeatures(object): except NotImplementedError: return False + def introspected_boolean_field_type(self, field=None, created_separately=False): + """ + What is the type returned when the backend introspects a BooleanField? + The optional arguments may be used to give further details of the field to be + introspected; in particular, they are provided by Django's test suite: + field -- the field definition + created_separately -- True if the field was added via a SchemaEditor's AddField, + False if the field was created with the model + + Note that return value from this function is compared by tests against actual + introspection results; it should provide expectations, not run an introspection + itself. + """ + if self.can_introspect_null and field and field.null: + return 'NullBooleanField' + return 'BooleanField' + class BaseDatabaseOperations(object): """ |
