diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/wizards.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index b3e5c4122..21cfa6ceb 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -58,6 +58,7 @@ class Wizard(NamedUrlWizardView): translated_keys = ['title'] wizard_done_template = 'ishtar/wizard/wizard_done.html' wizard_done_window = '' + wizard_confirm = 'ishtar/wizard/confirm_wizard.html' wizard_templates = {} @staticmethod @@ -107,7 +108,7 @@ class Wizard(NamedUrlWizardView): if current_step in wizard_templates: templates = [wizard_templates[current_step]] + templates elif current_step == self.steps.last: - templates = ['ishtar/wizard/confirm_wizard.html'] + templates + templates = [self.wizard_confirm] + templates return templates def get_context_data(self, form, **kwargs): @@ -626,6 +627,18 @@ class Wizard(NamedUrlWizardView): files=self.storage.get_step_files(self.steps.current)) return self.render(form) + def session_get_keys(self, form_key): + """Get list of available keys for a specific form + """ + request = self.request + storage = self.storage + test = storage.prefix in request.session \ + and 'step_data' in request.session[storage.prefix] \ + and form_key in request.session[storage.prefix]['step_data'] + if not test: + return [] + return request.session[storage.prefix]['step_data'][form_key].keys() + def session_has_key(self, form_key, key=None, multi=None): """Check if the session has value of a specific form and (if provided) of a key @@ -691,9 +704,12 @@ class Wizard(NamedUrlWizardView): if k.startswith(form_key) and k.endswith(key) and \ request.session[storage.prefix]['step_data'][form_key][k]: val = request.session[storage.prefix]['step_data'][form_key][k] + number = int(k[len(form_key):-len(key)].strip('-')) if type(val) in (list, tuple): val = val[0] - vals.append(val) + vals.append((number, val)) + # reorder list + vals = [v for idx, v in sorted(vals)] return vals def get_current_object(self): |