From 89e94b9e2e18ce0f4a9572258b85e401463eb0ea Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 14 Sep 2019 09:03:56 +0200 Subject: Context records: multiple deletion - redirections after wizard changes --- ishtar_common/forms.py | 2 +- ishtar_common/wizards.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 04cd5a327..5be5deafe 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -395,7 +395,7 @@ class MultiSearchForm(CustomFormSearch): raise NotImplementedError("A \"pk\" field must be defined") if self.pk_key not in self.associated_models: raise NotImplementedError("\"{}\" must be defined in " - "associated_models") + "associated_models".format(self.pk_key)) self.fields['pk'].required = True self.fields[self.pk_key] = self.fields.pop('pk') diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 9c89fd04b..0c13139df 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -1527,7 +1527,7 @@ class DeletionWizard(Wizard): (hasattr(self, 'model') and hasattr(self.model, 'TABLE_COLS')): self.fields = self.model.TABLE_COLS assert self.model - return super(DeletionWizard, self).__init__(*args, **kwargs) + super(DeletionWizard, self).__init__(*args, **kwargs) def get_formated_datas(self, forms): datas = super(DeletionWizard, self).get_formated_datas(forms) @@ -1604,7 +1604,14 @@ class MultipleDeletionWizard(MultipleItemWizard): (hasattr(self, 'model') and hasattr(self.model, 'TABLE_COLS')): self.fields = self.model.TABLE_COLS assert self.model - return super(MultipleDeletionWizard, self).__init__(*args, **kwargs) + super(MultipleDeletionWizard, self).__init__(*args, **kwargs) + + def get_template_names(self): + current_step = self.steps.current + if current_step.startswith("final-") and \ + current_step not in self.wizard_templates: + return ["ishtar/wizard/delete_wizard.html"] + return super(MultipleDeletionWizard, self).get_template_names() def get_formated_datas(self, forms): datas = super(MultipleDeletionWizard, self).get_formated_datas(forms) -- cgit v1.2.3