kopia lustrzana https://github.com/wagtail/wagtail
Ensure deconstruct is consistent
Regardless of whether it was created with `page_type` or `target_model`. Similarly to the `__init__` method, we cannot completely deprecate `target_model` so the `deconstruct` method has to handle both parameters.pull/5123/head
rodzic
09bc28fc86
commit
863d066786
|
@ -651,7 +651,7 @@ class PageChooserBlock(ChooserBlock):
|
|||
def deconstruct(self):
|
||||
name, args, kwargs = super().deconstruct()
|
||||
|
||||
if 'page_type' in kwargs:
|
||||
if 'target_model' in kwargs or 'page_type' in kwargs:
|
||||
target_models = []
|
||||
|
||||
for target_model in self.target_models:
|
||||
|
@ -660,6 +660,7 @@ class PageChooserBlock(ChooserBlock):
|
|||
'{}.{}'.format(opts.app_label, opts.object_name)
|
||||
)
|
||||
|
||||
kwargs.pop('target_model', None)
|
||||
kwargs['page_type'] = target_models
|
||||
|
||||
return name, args, kwargs
|
||||
|
|
Ładowanie…
Reference in New Issue