summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-04-01 20:37:17 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2014-04-01 20:37:48 +0200
commit789e8e46dd1a3731c8014901470b8151bc1331db (patch)
treeb9867b4b895adededac4295a12ea93af3da4c5e8 /archaeological_operations
parente78ad3b5da5864639eef17c157e6607311c47c0b (diff)
downloadIshtar-789e8e46dd1a3731c8014901470b8151bc1331db.tar.bz2
Ishtar-789e8e46dd1a3731c8014901470b8151bc1331db.zip
Add operation code readonly field on operation modification (refs #1730)
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/forms.py9
-rw-r--r--archaeological_operations/views.py2
2 files changed, 9 insertions, 2 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index bca08230f..cb4b52fe3 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2010-2014 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -392,6 +392,13 @@ class OperationFormGeneral(forms.Form):
raise forms.ValidationError(msg)
return self.cleaned_data
+class OperationFormModifGeneral(OperationFormGeneral):
+ operation_code = forms.IntegerField(label=_(u"Operation code"),
+ initial=models.Operation.get_available_operation_code)
+ def __init__(self, *args, **kwargs):
+ super(OperationFormGeneral, self).__init__(*args, **kwargs)
+ self.fields['operation_code'].widget.attrs['readonly'] = True
+
class OperationFormPreventive(forms.Form):
form_label = _(u"Preventive informations - excavation")
cost = forms.IntegerField(label=_(u"Cost (€)"), required=False)
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index a957fe8c1..b0676b45c 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -203,7 +203,7 @@ operation_creation_wizard = OperationWizard.as_view([
operation_modification_wizard = OperationModificationWizard.as_view([
('selec-operation_modification', OperationFormSelection),
- ('general-operation_modification', OperationFormGeneral),
+ ('general-operation_modification', OperationFormModifGeneral),
('preventive-operation_modification', OperationFormPreventive),
('preventivediag-operation_modification', OperationFormPreventiveDiag),
('towns-operation_modification', SelectedTownFormset),