summaryrefslogtreecommitdiff
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
commite25f2b0f735c3a72629f988d9ebfdaa9307c9a4c (patch)
treeb9867b4b895adededac4295a12ea93af3da4c5e8
parent8290d9d47979b7d5d6bd311bec5943d20a7da480 (diff)
downloadIshtar-e25f2b0f735c3a72629f988d9ebfdaa9307c9a4c.tar.bz2
Ishtar-e25f2b0f735c3a72629f988d9ebfdaa9307c9a4c.zip
Add operation code readonly field on operation modification (refs #1730)
-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),