summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 23469c659..29496d21b 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -85,10 +85,8 @@ def check_rights_condition(rights):
if request.user.ishtaruser.has_right('administrator', request.session):
return True
for right in rights:
- print(right)
if request.user.ishtaruser.has_right(right, request.session):
return True
- print('hop')
return False
return func
@@ -104,6 +102,7 @@ class Wizard(NamedUrlWizardView):
wizard_done_window = ''
wizard_confirm = 'ishtar/wizard/confirm_wizard.html'
wizard_templates = {}
+ filter_owns = {}
@staticmethod
def _check_right(step, condition=True):
@@ -153,6 +152,10 @@ class Wizard(NamedUrlWizardView):
current_object and not current_object.is_own(request.user):
self.session_reset(request, self.url_name)
return HttpResponseRedirect('/')
+ # extra filter on forms
+ self.filter_owns_items = True
+ else:
+ self.filter_owns_items = False
return super(Wizard, self).dispatch(request, *args, **kwargs)
@@ -671,10 +674,21 @@ class Wizard(NamedUrlWizardView):
and form.forms[0].fields.keys():
frm = form.forms[0]
if frm:
+ # autofocus on first field
first_field = frm.fields[frm.fields.keyOrder[0]]
attrs = first_field.widget.attrs
attrs.update({'autofocus': "autofocus"})
first_field.widget.attrs = attrs
+ if not step:
+ step = self.steps.current
+ if self.filter_owns_items and self.filter_owns \
+ and step in self.filter_owns:
+ for key in self.filter_owns[step]:
+ frm.fields[key].widget.source = unicode(
+ frm.fields[key].widget.source) + "own/"
+ if frm.fields[key].widget.source_full is not None:
+ frm.fields[key].widget.source_full = unicode(
+ frm.fields[key].widget.source_full) + "own/"
return form
def render_next_step(self, form, **kwargs):