summaryrefslogtreecommitdiff
path: root/archaeological_operations/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-04-13 13:23:35 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-04-13 13:23:35 +0200
commitae9366fc3f24d869fa9cce7c0077d06e6db95571 (patch)
tree71d968e3d0b0571b4c1d1bef036774f30e98dbcf /archaeological_operations/wizards.py
parentb790e4875b47e2951a65eedd36dc661079667541 (diff)
downloadIshtar-ae9366fc3f24d869fa9cce7c0077d06e6db95571.tar.bz2
Ishtar-ae9366fc3f24d869fa9cce7c0077d06e6db95571.zip
New type of operation: court-ordered seizure with associated fields (refs #4048)
* models * migrations * wizard panel * forms * sheet
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r--archaeological_operations/wizards.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index ddad8dd2e..d4830a2e7 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -526,6 +526,28 @@ def is_not_preventive(form_name, model, type_key='operation_type', key=''):
return func
+def is_judiciary(form_name, model, type_key='operation_type'):
+ def func(self):
+ request = self.request
+ storage = self.storage
+ if storage.prefix not in request.session or \
+ 'step_data' not in request.session[storage.prefix] or \
+ form_name not in request.session[storage.prefix]['step_data'] \
+ or form_name + '-' + type_key not in \
+ request.session[storage.prefix]['step_data'][form_name]:
+ return False
+ try:
+ typ = request.session[storage.prefix][
+ 'step_data'][form_name][form_name + '-' + type_key]
+ if type(typ) in (list, tuple):
+ typ = typ[0]
+ typ = int(typ)
+ return model.is_judiciary(typ)
+ except ValueError:
+ return False
+ return func
+
+
def has_associated_file(form_name, file_key='associated_file', negate=False):
def func(self):
request = self.request