summaryrefslogtreecommitdiff
path: root/archaeological_context_records/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-06 10:36:40 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-06 10:36:40 +0200
commit82e78630103d8e40eed2113f09ee1c69fc6841b3 (patch)
treea1032c5f387c6d1756961f8094b082da2d8d6810 /archaeological_context_records/forms.py
parent47f0cad81d3033d69d3f3c1a576624993ec5c043 (diff)
downloadIshtar-82e78630103d8e40eed2113f09ee1c69fc6841b3.tar.bz2
Ishtar-82e78630103d8e40eed2113f09ee1c69fc6841b3.zip
Context record: can change operation (refs #3080)
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r--archaeological_context_records/forms.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index 462300317..225b49bfb 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -43,6 +43,18 @@ from archaeological_operations.forms import OperationSelect, ParcelField,\
RecordRelationsForm as OpeRecordRelationsForm
+class OperationFormSelection(forms.Form):
+ form_label = _("Operation")
+ associated_models = {'operation': Operation}
+ currents = {'operation': Operation}
+ operation = forms.IntegerField(
+ label=_(u"Operation"), required=False,
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-operation'),
+ associated_model=Operation),
+ validators=[valid_id(Operation)])
+
+
class RecordSelect(TableSelect):
label = forms.CharField(label=_(u"ID"), max_length=100)
parcel__town = get_town_field()
@@ -149,6 +161,9 @@ class RecordFormGeneral(ManageOldType, forms.Form):
'context_record' in kwargs['data']):
if 'operation' in kwargs['data']:
operation = kwargs['data']['operation']
+ # force operation modification
+ kwargs['data'][kwargs['prefix'] + '-operation_id'] = \
+ operation.id
if 'context_record' in kwargs['data'] and \
kwargs['data']['context_record']:
operation = kwargs['data']['context_record'].operation