summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-12-27 17:53:15 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-12-27 17:55:37 +0100
commit0bbb58bdf1cad93846bec23d2481e5ffffa818f8 (patch)
tree9ba5641662d7abeb2c690595f3255eb9df32ccc1 /ishtar_common/wizards.py
parente027edce6edc7d8ba5a7dfc14069a95e531da2e1 (diff)
downloadIshtar-0bbb58bdf1cad93846bec23d2481e5ffffa818f8.tar.bz2
Ishtar-0bbb58bdf1cad93846bec23d2481e5ffffa818f8.zip
Display current item window after creation and modification (refs #1574)
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index a237fb327..7add2faa8 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -34,7 +34,9 @@ import models
class MultiValueDict(BaseMultiValueDict):
def get(self, *args, **kwargs):
v = super(MultiValueDict, self).getlist(*args, **kwargs)
- if len(v) > 1:
+ if callable(v):
+ v = v()
+ if type(v) in (list, tuple) and len(v) > 1:
v = ",".join(v)
else:
v = super(MultiValueDict, self).get(*args, **kwargs)
@@ -46,6 +48,8 @@ class Wizard(NamedUrlWizardView):
modification = None # True when the wizard modify an item
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
translated_keys = ['title']
+ wizard_done_template = 'ishtar/wizard/wizard_done.html'
+ wizard_done_window = ''
@staticmethod
def _check_right(step, condition=True):
@@ -355,8 +359,9 @@ class Wizard(NamedUrlWizardView):
isinstance(obj.__class__._meta.get_field(k), ImageFile)):
if not dct[k]:
dct[k] = None
- if isinstance(obj.__class__._meta.get_field(k),
- ManyToManyField):
+ if not k.endswith('_id') and (
+ isinstance(obj.__class__._meta.get_field(k),
+ ManyToManyField)):
if not dct[k]:
dct[k] = []
elif type(dct[k]) not in (list, tuple):
@@ -439,7 +444,12 @@ class Wizard(NamedUrlWizardView):
# necessary to manage interaction between models like
# material_index management for baseitems
obj.save()
- res = render_to_response('ishtar/wizard/wizard_done.html', {},
+ dct = {'item':obj}
+ # force evaluation of lazy urls
+ wizard_done_window = unicode(self.wizard_done_window)
+ if wizard_done_window:
+ dct['wizard_done_window'] = wizard_done_window
+ res = render_to_response(self.wizard_done_template, dct,
context_instance=RequestContext(self.request))
return return_object and (obj, res) or res