Fixed #23156 -- Added missing BinaryField.deconstruct() method.

This commit is contained in:
Baptiste Mispelon 2014-08-03 12:59:21 +02:00
parent a9fa3d4667
commit 72f1eb48df
2 changed files with 12 additions and 0 deletions

View File

@ -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"

View File

@ -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, {})