summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-23 11:52:54 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-23 11:52:54 +0100
commit492a1b9c0acee48cb6d9334d93ab55512a5981a6 (patch)
tree4d0441a7deb96b5fa0dd31416f3a2d8e9ebab4c4 /archaeological_operations/forms.py
parenta2d98fb25b40c7aca6e0683abb09a50700f325b5 (diff)
downloadIshtar-492a1b9c0acee48cb6d9334d93ab55512a5981a6.tar.bz2
Ishtar-492a1b9c0acee48cb6d9334d93ab55512a5981a6.zip
Operation forms: filter some fields if "files" module is not activated (ref #3367)
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 27ab4670a..041458ecd 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -857,21 +857,29 @@ class OperationFormGeneral(ManageOldType, forms.Form):
def __init__(self, *args, **kwargs):
super(OperationFormGeneral, self).__init__(*args, **kwargs)
- if not get_current_profile().warehouse:
- self.fields.pop('documentation_deadline')
- self.fields.pop('documentation_received')
- self.fields.pop('finds_deadline')
- self.fields.pop('finds_received')
+ profile = get_current_profile()
+ if not profile.files:
+ self.fields.pop('report_delivery_date')
+ self.fields.pop('report_processing')
+ self.fields.pop('cira_rapporteur')
+ self.fields.pop('cira_date')
+ self.fields.pop('negative_result')
+ if not profile.warehouse:
+ self.fields.pop('documentation_deadline')
+ self.fields.pop('documentation_received')
+ self.fields.pop('finds_deadline')
+ self.fields.pop('finds_received')
self.fields['operation_type'].choices = \
models.OperationType.get_types(
initial=self.init_data.get('operation_type'))
self.fields['operation_type'].help_text = \
models.OperationType.get_help()
- self.fields['report_processing'].choices = \
- models.ReportState.get_types(
- initial=self.init_data.get('report_processing'))
- self.fields['report_processing'].help_text = \
- models.ReportState.get_help()
+ if 'report_processing' in self.fields:
+ self.fields['report_processing'].choices = \
+ models.ReportState.get_types(
+ initial=self.init_data.get('report_processing'))
+ self.fields['report_processing'].help_text = \
+ models.ReportState.get_help()
self.fields['record_quality'].choices = \
[('', '--')] + list(models.QUALITY)
if 'operation_code' in self.fields: