summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-11-08 20:33:26 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-11-08 20:34:08 +0100
commitf7f7543d603595fcfb9846f8d9eefc774bf0ecc8 (patch)
treedaa9339b15c8037f87c3601894476d5fe2f51a4e /ishtar_common/wizards.py
parent67d5f18e392e6454dfdbddbb6c151b570c7de784 (diff)
downloadIshtar-f7f7543d603595fcfb9846f8d9eefc774bf0ecc8.tar.bz2
Ishtar-f7f7543d603595fcfb9846f8d9eefc774bf0ecc8.zip
Allow deactivation of "auto-pin" and of "pin menu" in the profile (refs #4307)
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 499f008b4..d0a7df84b 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -906,10 +906,13 @@ class Wizard(IshtarWizard):
# post save/m2m specific fix
obj.fix()
- # make the new object a default
- if self.current_obj_slug:
- self.request.session[self.current_obj_slug] = unicode(obj.pk)
- self.request.session[self.get_object_name(obj)] = unicode(obj.pk)
+ ishtaruser = self.request.user.ishtaruser \
+ if hasattr(self.request.user, 'ishtaruser') else None
+ if ishtaruser and ishtaruser.current_profile.auto_pin:
+ # make the new object a default
+ if self.current_obj_slug:
+ self.request.session[self.current_obj_slug] = unicode(obj.pk)
+ self.request.session[self.get_object_name(obj)] = unicode(obj.pk)
dct = {'item': obj}
self.current_object = obj
# force evaluation of lazy urls
@@ -1384,8 +1387,11 @@ class Wizard(IshtarWizard):
current_step = step or self.steps.current
c_form = self.form_list[current_step]
- # make the current object the default item for the session
- self.request.session[self.get_object_name(obj)] = unicode(obj.pk)
+ ishtaruser = self.request.user.ishtaruser \
+ if hasattr(self.request.user, 'ishtaruser') else None
+ if ishtaruser and ishtaruser.current_profile.auto_pin:
+ # make the current object the default item for the session
+ self.request.session[self.get_object_name(obj)] = unicode(obj.pk)
initial = MultiValueDict()
# posted data or already in session