From 72f1eb48df335c110f39d56f7978d95896a56bb8 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Sun, 3 Aug 2014 12:59:21 +0200 Subject: [PATCH] Fixed #23156 -- Added missing BinaryField.deconstruct() method. --- django/db/models/fields/__init__.py | 5 +++++ tests/field_deconstruction/tests.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 3d8a5b79ad..a0f72a7fd6 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -2178,6 +2178,11 @@ class BinaryField(Field): if self.max_length is not None: self.validators.append(validators.MaxLengthValidator(self.max_length)) + def deconstruct(self): + name, path, args, kwargs = super(BinaryField, self).deconstruct() + del kwargs['editable'] + return name, path, args, kwargs + def get_internal_type(self): return "BinaryField" diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py index 5a424eea3c..be73f8b19e 100644 --- a/tests/field_deconstruction/tests.py +++ b/tests/field_deconstruction/tests.py @@ -347,3 +347,10 @@ class FieldDeconstructionTests(TestCase): self.assertEqual(path, "django.db.models.URLField") self.assertEqual(args, []) self.assertEqual(kwargs, {"max_length": 231}) + + def test_binary_field(self): + field = models.BinaryField() + name, path, args, kwargs = field.deconstruct() + self.assertEqual(path, "django.db.models.BinaryField") + self.assertEqual(args, []) + self.assertEqual(kwargs, {})