diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-05 16:13:57 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-05 19:15:37 -0500 |
| commit | fc1e9107d7d750f6eed3c8e679dfe96af8f05150 (patch) | |
| tree | acc70aea6542a1070510986ec9a3fa266b0d5e37 | |
| parent | c9addfd4bfadde043a1aec7854b285aa212bdd5a (diff) | |
[1.8.x] Added UUIDField.deconstruct()
Backport of 0f54cf28c09a80254571487e3af93be2096cfdac from master
| -rw-r--r-- | django/db/models/fields/__init__.py | 5 | ||||
| -rw-r--r-- | tests/model_fields/test_uuid.py | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 627af0c985..c46851c7fe 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -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" diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py index 13fe245be3..d2ffe71a3a 100644 --- a/tests/model_fields/test_uuid.py +++ b/tests/model_fields/test_uuid.py @@ -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 = [ |
