diff options
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 |
commit | 3555eccdccc0ea67459fabf0a12b85e31b017758 (patch) | |
tree | daa9339b15c8037f87c3601894476d5fe2f51a4e /ishtar_common/wizards.py | |
parent | a8172b647980667bef078c865034b52f6523be4b (diff) | |
download | Ishtar-3555eccdccc0ea67459fabf0a12b85e31b017758.tar.bz2 Ishtar-3555eccdccc0ea67459fabf0a12b85e31b017758.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.py | 18 |
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 |