summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r--archaeological_finds/forms.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 800fba34f..e25d52805 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -460,6 +460,8 @@ class UpstreamFindFormSelection(FindFormSelection):
def __init__(self, *args, **kwargs):
super(UpstreamFindFormSelection, self).__init__(*args, **kwargs)
self.fields['pk'].required = True
+ self.fields['resulting_pk'] = self.fields.pop('pk')
+
##############################################
# Source management for archaeological finds #
@@ -576,6 +578,18 @@ class FindBasketAddItemForm(forms.Form):
return basket
+class TreatmentFormSelection(forms.Form):
+ form_label = _("Treatment search")
+ associated_models = {'pk': models.Treatment}
+ currents = {'pk': models.Treatment}
+ pk = forms.IntegerField(
+ label="", required=False,
+ widget=widgets.JQueryJqGrid(
+ reverse_lazy('get-treatment'),
+ FindSelect, models.Treatment),
+ validators=[valid_id(models.Treatment)])
+
+
class BaseTreatmentForm(ManageOldType, SelectFindBasketForm):
form_label = _(u"Base treatment")
associated_models = {'treatment_type': models.TreatmentType,
@@ -606,12 +620,17 @@ class BaseTreatmentForm(ManageOldType, SelectFindBasketForm):
super(BaseTreatmentForm, self).__init__(*args, **kwargs)
self.fields['treatment_type'].choices = models.TreatmentType.get_types(
initial=self.init_data.get('treatment_type'),
- exclude=['packaging'])
+ dct={'upstream_is_many': False, 'downstream_is_many': False}
+ )
self.fields['treatment_type'].help_text = \
- models.TreatmentType.get_help(exclude=['packaging'])
+ models.TreatmentType.get_help(
+ dct={'upstream_is_many': False, 'downstream_is_many': False})
self.fields['basket'].required = False
self.fields['basket'].help_text = \
_(u"Leave it blank if you want to select a single item")
+ self.fields.keyOrder.pop(self.fields.keyOrder.index('basket'))
+ self.fields.keyOrder.insert(self.fields.keyOrder.index('description'),
+ 'basket')
def clean(self, *args, **kwargs):
try: