diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-10-21 19:24:56 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-10-21 19:24:56 +0200 |
commit | 661180e434f94afdec0a6ee86b5c1aa1a7aa354f (patch) | |
tree | 45d5fe6bcd60fe66954db08976a649bfa9203747 /ishtar_common/wizards.py | |
parent | 92c84e043c6e788190980883265e50ed8a1fa5a1 (diff) | |
download | Ishtar-661180e434f94afdec0a6ee86b5c1aa1a7aa354f.tar.bz2 Ishtar-661180e434f94afdec0a6ee86b5c1aa1a7aa354f.zip |
Djangoization - Major refactoring (step 10)
* Fix operation wizards
* Minor fix on other wizards
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index fb6ad22e2..373ee0e41 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -551,13 +551,19 @@ class Wizard(NamedUrlWizardView): storage = self.storage if not multi: key = key.startswith(form_key) and key or form_key + '-' + key - return request.session[storage.prefix]['step_data'][form_key][key] + val = request.session[storage.prefix]['step_data'][form_key][key] + if type(val) in (list, tuple): + val = val[0] + return val vals = [] for k in request.session[storage.prefix]['step_data'][form_key]: if k.startswith(form_key) and k.endswith(key) and \ request.session[storage.prefix]['step_data'][form_key][k]: - vals.append(request.session[storage.prefix]['step_data']\ - [form_key][k]) + val = request.session[storage.prefix]['step_data']\ + [form_key][k] + if type(val) in (list, tuple): + val = val[0] + vals.append(val) return vals def get_current_object(self): @@ -567,8 +573,6 @@ class Wizard(NamedUrlWizardView): main_form_key = 'selec-' + self.url_name try: idx = self.session_get_value(main_form_key, 'pk') - if type(idx) in (tuple, list): - idx = idx[0] idx = int(idx) current_obj = self.model.objects.get(pk=idx) except(TypeError, ValueError, ObjectDoesNotExist): |