summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 38efb269f..bf69a74b5 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -1288,6 +1288,32 @@ class SiteFormSelection(IshtarForm):
return cleaned_data
+class SiteForm(ManageOldType):
+ form_label = _(u"General")
+ form_admin_name = _(u"Archaeological site - 010 - General")
+ associated_models = {'period': models.Period, 'remain': models.RemainType}
+ reference = forms.CharField(label=_(u"Reference"), max_length=20)
+ name = forms.CharField(label=_(u"Name"), max_length=200, required=False)
+ period = forms.MultipleChoiceField(
+ label=_("Periods"), choices=[], widget=widgets.Select2Multiple,
+ required=False)
+ remain = forms.MultipleChoiceField(
+ label=_("Remains"), choices=[], widget=widgets.Select2Multiple,
+ required=False)
+
+ TYPES = [
+ FieldType('period', models.Period, True),
+ FieldType('remain', models.RemainType, True),
+ ]
+
+ def clean_reference(self):
+ reference = self.cleaned_data['reference']
+ if models.ArchaeologicalSite.objects.filter(
+ reference=reference).count():
+ raise forms.ValidationError(_(u"This reference already exists."))
+ return reference
+
+
####################################
# Source management for operations #
####################################