summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms_treatments.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/forms_treatments.py')
-rw-r--r--archaeological_finds/forms_treatments.py45
1 files changed, 21 insertions, 24 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index 50469828b..4731e91e2 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -395,26 +395,7 @@ class TreatmentDeletionForm(FinalForm):
confirm_end_msg = _("Would you like to delete this treatment?")
-class QAFindTreatmentForm(IshtarForm):
- container = forms.IntegerField(
- label=_("Container"),
- widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-container'),
- associated_model=Container, new=True),
- validators=[valid_id(Container)])
- container_to_change = forms.ChoiceField(
- label=_("Change "), required=True,
- choices=(
- ('current-and-reference', _("reference and current containers")),
- ('reference', _("the reference container")),
- ('current', _("the current container")),
- )
- )
- #collection = forms.BooleanField(
- # label=_("Associate to the collection of the container"),
- # required=False,
- # widget=widgets.CheckboxInput
- #)
+class QABasePackagingForm(IshtarForm):
create_treatment = forms.BooleanField(
label=_("Create a treatment"), required=False,
widget=widgets.CheckboxInput
@@ -483,14 +464,13 @@ class QAFindTreatmentForm(IshtarForm):
)
super().__init__(*args, **kwargs)
- if not self.user:
- return
-
# treatment type is dynamic put all for check
self.fields['treatment_type'].choices = [
(tt.pk, str(tt)) for tt in set(
- tt_change_ref_loca + tt_change_current_loca + tt_change_both_loca)
+ tt_change_ref_loca + tt_change_current_loca + tt_change_both_loca)
]
+ if not self.user:
+ return
q = Person.objects.filter(ishtaruser__pk=self.user.pk)
if q.count():
@@ -512,6 +492,23 @@ class QAFindTreatmentForm(IshtarForm):
return self.cleaned_data
+
+class QAFindTreatmentForm(QABasePackagingForm):
+ container = forms.IntegerField(
+ label=_("Container"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-container'),
+ associated_model=Container, new=True),
+ validators=[valid_id(Container)])
+ container_to_change = forms.ChoiceField(
+ label=_("Change "), required=True,
+ choices=(
+ ('current-and-reference', _("reference and current containers")),
+ ('reference', _("the reference container")),
+ ('current', _("the current container")),
+ )
+ )
+
def save(self, items, user):
container = Container.objects.get(pk=self.cleaned_data['container'])
container_to_change = self.cleaned_data.get('container_to_change', '')