Kaydet (Commit) 2e557908 authored tarafından Simon Charette's avatar Simon Charette Kaydeden (comit) Tim Graham

Refs #25226 -- Cloned ArrayField.base_field on deconstruction.

This prevents the base_field from sharing attributes with the one used
during migrations.
üst f4c0eec7
......@@ -92,7 +92,7 @@ class ArrayField(Field):
if path == 'django.contrib.postgres.fields.array.ArrayField':
path = 'django.contrib.postgres.fields.ArrayField'
kwargs.update({
'base_field': self.base_field,
'base_field': self.base_field.clone(),
'size': self.size,
})
return name, path, args, kwargs
......
......@@ -441,6 +441,7 @@ class TestMigrations(TransactionTestCase):
name, path, args, kwargs = field.deconstruct()
new = ArrayField(*args, **kwargs)
self.assertEqual(type(new.base_field), type(field.base_field))
self.assertIsNot(new.base_field, field.base_field)
def test_deconstruct_with_size(self):
field = ArrayField(models.IntegerField(), size=3)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment