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.py64
1 files changed, 46 insertions, 18 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 9cc73e63b..1dbafbd14 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -1306,17 +1306,42 @@ class SiteForm(CustomForm, ManageOldType):
form_label = _("General")
form_admin_name = _("Archaeological site - 010 - General")
form_slug = "archaeological_site-010-general"
- associated_models = {'period': models.Period, 'remain': models.RemainType,
- 'spatial_reference_system': SpatialReferenceSystem,
- 'cultural_attribution': models.CulturalAttributionType,
- 'collaborator': Person}
- base_models = ["period", "remain", "collaborator", "cultural_attribution"]
+ associated_models = {
+ 'period': models.Period, 'remain': models.RemainType,
+ 'spatial_reference_system': SpatialReferenceSystem,
+ 'cultural_attribution': models.CulturalAttributionType,
+ 'collaborator': Person,
+ 'discoverer': Person,
+ "nature_of_site": models.NatureOfSiteType,
+ "interpretation_level": models.InterpretationLevelType,
+ "discovery_status": models.SiteDiscoveryStatusType,
+ "current_status": models.SiteCurrentStatusType,
+ "town": Town,
+ "type": models.SiteType,
+ }
+ base_models = ["period", "remain", "collaborator", "cultural_attribution", "town", "type"]
pk = forms.IntegerField(required=False, widget=forms.HiddenInput)
reference = forms.CharField(label=_("Reference"), max_length=200)
name = forms.CharField(label=_("Name"), max_length=200, required=False)
other_reference = forms.CharField(label=_("Other reference"),
required=False)
+ collaborator = widgets.Select2MultipleField(
+ model=Person, label=_("Collaborators"), required=False, remote=True)
+ description = forms.CharField(label=_("Description"), widget=forms.Textarea,
+ required=False)
+ public_description = forms.CharField(label=_("Public description"), widget=forms.Textarea,
+ required=False)
+ comment = forms.CharField(label=_("Comment"), widget=forms.Textarea,
+ required=False)
+ HEADERS['type'] = FormHeader(_("Scientific"))
+ type = forms.MultipleChoiceField(
+ label=_("Types"), choices=[], widget=widgets.Select2Multiple,
+ required=False)
+ nature_of_site = forms.ChoiceField(choices=[], label=_("Nature of site"), required=False)
+ interpretation_level = forms.ChoiceField(choices=[], label=_("Interpretation level"), required=False)
+ discovery_status = forms.ChoiceField(choices=[], label=_("Discovery status"), required=False)
+ current_status = forms.ChoiceField(choices=[], label=_("Current status"), required=False)
period = forms.MultipleChoiceField(
label=_("Periods"), choices=[], widget=widgets.Select2Multiple,
required=False)
@@ -1327,10 +1352,16 @@ class SiteForm(CustomForm, ManageOldType):
label=_("Cultural attributions"), choices=[],
widget=widgets.Select2Multiple,
required=False)
- collaborator = widgets.Select2MultipleField(
- model=Person, label=_("Collaborators"), required=False, remote=True)
- comment = forms.CharField(label=_("Comment"), widget=forms.Textarea,
- required=False)
+ discoverer = widgets.Select2SimpleField(
+ model=Person, label=_("Discoverer"), required=False, remote=True)
+ HEADERS['town'] = FormHeader(_("Localization"))
+ town = widgets.Select2MultipleField(
+ model=Town, label=_("Towns"), required=False, remote=True
+ )
+ precise_locality = forms.CharField(
+ label=_("Precise locality"),
+ widget=forms.Textarea, required=False
+ )
locality_ngi = forms.CharField(
label=_("National Geographic Institute locality"),
widget=forms.Textarea, required=False
@@ -1341,15 +1372,19 @@ class SiteForm(CustomForm, ManageOldType):
)
TYPES = [
+ FieldType('type', models.SiteType, True),
FieldType('period', models.Period, True),
FieldType('remain', models.RemainType, True),
FieldType('cultural_attribution',
models.CulturalAttributionType, True),
- FieldType('spatial_reference_system', SpatialReferenceSystem),
+ FieldType('nature_of_site', models.NatureOfSiteType),
+ FieldType('interpretation_level', models.InterpretationLevelType),
+ FieldType('current_status', models.SiteCurrentStatusType),
+ FieldType('discovery_status', models.SiteDiscoveryStatusType),
]
def __init__(self, *args, **kwargs):
- super(SiteForm, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
if 'collaborator' in self.fields:
self.fields['collaborator'].widget.attrs['full-width'] = True
@@ -1363,13 +1398,6 @@ class SiteForm(CustomForm, ManageOldType):
return reference
-SiteTownFormset = formset_factory(TownForm, can_delete=True,
- formset=TownFormSet)
-SiteTownFormset.form_label = _("Towns")
-SiteTownFormset.form_admin_name = _("Archaeological site - 020 - Towns")
-SiteTownFormset.form_slug = "archaeological_site-020-towns"
-
-
def check_underwater_module(self):
return get_current_profile().underwater