From ae9366fc3f24d869fa9cce7c0077d06e6db95571 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 13 Apr 2018 13:23:35 +0200 Subject: New type of operation: court-ordered seizure with associated fields (refs #4048) * models * migrations * wizard panel * forms * sheet --- archaeological_operations/wizards.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'archaeological_operations/wizards.py') 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 -- cgit v1.2.3