Refs #27869 -- Omitted field kwargs from GinIndex.deconstruct() if they're None.
This commit is contained in:
parent
fb42d02471
commit
e016c4c65b
|
@ -42,7 +42,9 @@ class GinIndex(Index):
|
||||||
|
|
||||||
def deconstruct(self):
|
def deconstruct(self):
|
||||||
path, args, kwargs = super().deconstruct()
|
path, args, kwargs = super().deconstruct()
|
||||||
|
if self.fastupdate is not None:
|
||||||
kwargs['fastupdate'] = self.fastupdate
|
kwargs['fastupdate'] = self.fastupdate
|
||||||
|
if self.gin_pending_list_limit is not None:
|
||||||
kwargs['gin_pending_list_limit'] = self.gin_pending_list_limit
|
kwargs['gin_pending_list_limit'] = self.gin_pending_list_limit
|
||||||
return path, args, kwargs
|
return path, args, kwargs
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,13 @@ class GinIndexTests(PostgreSQLTestCase):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_deconstruct_no_args(self):
|
||||||
|
index = GinIndex(fields=['title'], name='test_title_gin')
|
||||||
|
path, args, kwargs = index.deconstruct()
|
||||||
|
self.assertEqual(path, 'django.contrib.postgres.indexes.GinIndex')
|
||||||
|
self.assertEqual(args, ())
|
||||||
|
self.assertEqual(kwargs, {'fields': ['title'], 'name': 'test_title_gin'})
|
||||||
|
|
||||||
|
|
||||||
class SchemaTests(PostgreSQLTestCase):
|
class SchemaTests(PostgreSQLTestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue