Refs #24928 -- Added introspection support for UUIDField

This commit is contained in:
Claude Paroz 2016-07-20 09:01:57 +02:00
parent 271bfe65d9
commit 3ea7167bb5
3 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
1184: 'DateTimeField',
1266: 'TimeField',
1700: 'DecimalField',
2950: 'UUIDField',
}
ignored_tables = []

View File

@ -67,6 +67,7 @@ class ColumnTypes(models.Model):
text_field = models.TextField()
time_field = models.TimeField()
url_field = models.URLField()
uuid_field = models.UUIDField()
class UniqueTogether(models.Model):

View File

@ -87,6 +87,11 @@ class InspectDBTestCase(TestCase):
if (connection.features.can_introspect_max_length and
not connection.features.interprets_empty_strings_as_nulls):
assertFieldType('url_field', "models.CharField(max_length=200)")
if connection.features.has_native_uuid_field:
assertFieldType('uuid_field', "models.UUIDField()")
elif (connection.features.can_introspect_max_length and
not connection.features.interprets_empty_strings_as_nulls):
assertFieldType('uuid_field', "models.CharField(max_length=32)")
def test_number_field_types(self):
"""Test introspection of various Django field types"""