mirror of https://github.com/django/django.git
Refs #24928 -- Added introspection support for UUIDField
This commit is contained in:
parent
271bfe65d9
commit
3ea7167bb5
|
@ -30,6 +30,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
|
|||
1184: 'DateTimeField',
|
||||
1266: 'TimeField',
|
||||
1700: 'DecimalField',
|
||||
2950: 'UUIDField',
|
||||
}
|
||||
|
||||
ignored_tables = []
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue