[1.8.x] Added UUIDField.deconstruct()

Backport of 0f54cf28c0 from master
This commit is contained in:
Tim Graham 2015-02-05 16:13:57 -05:00
parent c9addfd4bf
commit fc1e9107d7
2 changed files with 13 additions and 0 deletions

View File

@ -2374,6 +2374,11 @@ class UUIDField(Field):
kwargs['max_length'] = 32
super(UUIDField, self).__init__(**kwargs)
def deconstruct(self):
name, path, args, kwargs = super(UUIDField, self).deconstruct()
del kwargs['max_length']
return name, path, args, kwargs
def get_internal_type(self):
return "UUIDField"

View File

@ -35,6 +35,14 @@ class TestSaveLoad(TestCase):
self.assertEqual(loaded.field, None)
class TestMigrations(TestCase):
def test_deconstruct(self):
field = models.UUIDField()
name, path, args, kwargs = field.deconstruct()
self.assertEqual(kwargs, {})
class TestQuerying(TestCase):
def setUp(self):
self.objs = [