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.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 58c10971a..129a1446e 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -726,6 +726,31 @@ class QAFindBasketForm(IshtarForm):
basket.items.add(item)
+class QAFindDuplicateForm(IshtarForm):
+ label = forms.CharField(label=_("Free ID"), max_length=None, required=True)
+ denomination = forms.CharField(label=_("Denomination"), max_length=None,
+ required=False)
+ # modify = forms.BooleanField(label=_("Edit the new find"), required=False)
+
+ def __init__(self, *args, **kwargs):
+ self.user = None
+ if 'user' in kwargs:
+ self.user = kwargs.pop('user')
+ if hasattr(self.user, 'ishtaruser'):
+ self.user = self.user.ishtaruser
+ self.find = kwargs.pop('items')[0]
+ super(QAFindDuplicateForm, self).__init__(*args, **kwargs)
+ self.fields['label'].initial = self.find.label + str(
+ _(u" - duplicate"))
+ self.fields['denomination'].initial = self.find.denomination or ""
+
+ def save(self):
+ return self.find.duplicate(
+ self.user, duplicate_for_treatment=False,
+ data={"label": self.cleaned_data["label"],
+ "denomination": self.cleaned_data["denomination"]})
+
+
class QAFindbasketDuplicateForm(IshtarForm):
label = forms.CharField(label="", max_length=None, required=True)