mirror of https://github.com/django/django.git
Replaced an explicit vendor check by a feature flag.
This commit is contained in:
parent
1238f92c64
commit
c9aedce01a
|
@ -683,6 +683,9 @@ class BaseDatabaseFeatures(object):
|
||||||
# Can the backend introspect an BooleanField, instead of an IntegerField?
|
# Can the backend introspect an BooleanField, instead of an IntegerField?
|
||||||
can_introspect_boolean_field = True
|
can_introspect_boolean_field = True
|
||||||
|
|
||||||
|
# Can the backend introspect an DecimalField, instead of an FloatField?
|
||||||
|
can_introspect_decimal_field = True
|
||||||
|
|
||||||
# Can the backend introspect an IPAddressField, instead of an CharField?
|
# Can the backend introspect an IPAddressField, instead of an CharField?
|
||||||
can_introspect_ip_address_field = False
|
can_introspect_ip_address_field = False
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
||||||
supports_foreign_keys = False
|
supports_foreign_keys = False
|
||||||
supports_check_constraints = False
|
supports_check_constraints = False
|
||||||
autocommits_when_autocommit_is_off = True
|
autocommits_when_autocommit_is_off = True
|
||||||
|
can_introspect_decimal_field = False
|
||||||
can_introspect_positive_integer_field = True
|
can_introspect_positive_integer_field = True
|
||||||
can_introspect_small_integer_field = True
|
can_introspect_small_integer_field = True
|
||||||
supports_transactions = True
|
supports_transactions = True
|
||||||
|
|
|
@ -100,13 +100,12 @@ class InspectDBTestCase(TestCase):
|
||||||
else:
|
else:
|
||||||
assertFieldType('null_bool_field', "models.IntegerField()")
|
assertFieldType('null_bool_field', "models.IntegerField()")
|
||||||
|
|
||||||
if connection.vendor == 'sqlite':
|
if connection.features.can_introspect_decimal_field:
|
||||||
# Guessed arguments on SQLite, see #5014
|
assertFieldType('decimal_field', "models.DecimalField(max_digits=6, decimal_places=1)")
|
||||||
|
else: # Guessed arguments on SQLite, see #5014
|
||||||
assertFieldType('decimal_field', "models.DecimalField(max_digits=10, decimal_places=5) "
|
assertFieldType('decimal_field', "models.DecimalField(max_digits=10, decimal_places=5) "
|
||||||
"# max_digits and decimal_places have been guessed, "
|
"# max_digits and decimal_places have been guessed, "
|
||||||
"as this database handles decimal fields as float")
|
"as this database handles decimal fields as float")
|
||||||
else:
|
|
||||||
assertFieldType('decimal_field', "models.DecimalField(max_digits=6, decimal_places=1)")
|
|
||||||
|
|
||||||
assertFieldType('float_field', "models.FloatField()")
|
assertFieldType('float_field', "models.FloatField()")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue