diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 824200aba3..0db51ca60d 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -2014,6 +2014,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 cf699aeecd..3d593091f4 100644 --- a/tests/field_deconstruction/tests.py +++ b/tests/field_deconstruction/tests.py @@ -364,3 +364,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, {})