mirror of https://github.com/django/django.git
Refs #25809 -- Omitted pages_per_range from BrinIndex.deconstruct() if it's None.
This commit is contained in:
parent
3c0b2b80ed
commit
fb42d02471
|
@ -19,7 +19,8 @@ class BrinIndex(Index):
|
|||
|
||||
def deconstruct(self):
|
||||
path, args, kwargs = super().deconstruct()
|
||||
kwargs['pages_per_range'] = self.pages_per_range
|
||||
if self.pages_per_range is not None:
|
||||
kwargs['pages_per_range'] = self.pages_per_range
|
||||
return path, args, kwargs
|
||||
|
||||
def create_sql(self, model, schema_editor, using=''):
|
||||
|
|
|
@ -26,3 +26,6 @@ Bugfixes
|
|||
|
||||
* Added POST request support to ``LogoutView``, for equivalence with the
|
||||
function-based ``logout()`` view (:ticket:`28513`).
|
||||
|
||||
* Omitted ``pages_per_range`` from ``BrinIndex.deconstruct()`` if it's ``None``
|
||||
(:ticket:`25809`).
|
||||
|
|
|
@ -33,7 +33,7 @@ class BrinIndexTests(PostgreSQLTestCase):
|
|||
path, args, kwargs = index.deconstruct()
|
||||
self.assertEqual(path, 'django.contrib.postgres.indexes.BrinIndex')
|
||||
self.assertEqual(args, ())
|
||||
self.assertEqual(kwargs, {'fields': ['title'], 'name': 'test_title_brin', 'pages_per_range': None})
|
||||
self.assertEqual(kwargs, {'fields': ['title'], 'name': 'test_title_brin'})
|
||||
|
||||
def test_deconstruction_with_pages_per_range(self):
|
||||
index = BrinIndex(fields=['title'], name='test_title_brin', pages_per_range=16)
|
||||
|
|
Loading…
Reference in New Issue