Refs #25226 -- Cloned ArrayField.base_field on deconstruction.
This prevents the base_field from sharing attributes with the one used during migrations.
This commit is contained in:
parent
f4c0eec713
commit
2e55790838
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue