summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2026-03-31 12:37:41 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2026-03-31 15:17:12 +0200
commit7038c8e42b3bffb2db21c08f303551d4fa9b1389 (patch)
tree6844a3f18dd449cf115f0f21e19620e287cc9370
parent43651f3fb7dd3a0c90132d90b6c04ac3aee3552c (diff)
downloadIshtar-7038c8e42b3bffb2db21c08f303551d4fa9b1389.tar.bz2
Ishtar-7038c8e42b3bffb2db21c08f303551d4fa9b1389.zip
✨ sites - form: add heritage fields in edit forms
-rw-r--r--archaeological_operations/forms.py96
-rw-r--r--archaeological_operations/models.py2
2 files changed, 72 insertions, 26 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index f25d9f2cc..82f41c089 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -1309,49 +1309,79 @@ class SiteForm(CustomForm, ManageOldType):
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,
"actor": QualifiedBiographicalNote,
- 'discoverer': Person,
- "nature_of_site": models.NatureOfSiteType,
- "interpretation_level": models.InterpretationLevelType,
+ "collaborator": Person,
+ "cultural_attribution": models.CulturalAttributionType,
+ "current_state": models.SiteCurrentStatusType,
+ "discoverer": Person,
"discovery_status": models.SiteDiscoveryStatusType,
- "current_status": models.SiteCurrentStatusType,
+ "editor": models.Author,
+ "heritage_interest": models.HeritageInterestType,
+ "heritage_environmental_protection": models.HeritageAndEnvironmentalProtectionType,
+ "interpretation_level": models.InterpretationLevelType,
+ "nature_of_site": models.NatureOfSiteType,
+ "period": models.Period,
+ "remain": models.RemainType,
"town": Town,
"type": models.SiteType,
}
- extra_form_modals = ["qualifiedbiographicalnote", "biographicalnote", "person",
- "organization"]
- base_models = ["period", "remain", "collaborator", "cultural_attribution", "town",
- "type", "actor"]
-
+ extra_form_modals = ["author", "qualifiedbiographicalnote", "biographicalnote",
+ "person", "organization"]
+ base_models = [
+ "actor", "collaborator", "cultural_attribution", "current_state", "editor",
+ "heritage_interest", "heritage_environmental_protection", "period", "remain",
+ "town", "type"
+ ]
pk = forms.IntegerField(required=False, widget=forms.HiddenInput)
+ HEADERS['reference'] = FormHeader(_("General"))
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, new=True)
+ name = forms.CharField(label=_("Name"), max_length=200, required=False)
+ heritage_interest = forms.MultipleChoiceField(
+ label=_("Heritage interest"), choices=[], widget=widgets.Select2Multiple,
+ required=False)
actor = widgets.Select2MultipleField(
model=QualifiedBiographicalNote, label=_("Actors"), required=False,
remote=True, new=True)
+ collaborator = widgets.Select2MultipleField(
+ model=Person, label=_("Collaborators"), required=False,
+ remote=True, new=True)
description = forms.CharField(label=_("Description"), widget=forms.Textarea,
required=False)
- public_description = forms.CharField(label=_("Public 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['protection_id'] = FormHeader(_("Protection"))
+ protection_id = forms.CharField(label=_("Protection ID"), required=False)
+ protection_date = DateField(label=_("Protection date"), required=False)
+ heritage_environmental_protection = forms.MultipleChoiceField(
+ label=_("Heritage and environmental protections"), choices=[],
+ widget=widgets.Select2Multiple, required=False)
+ details_on_protection = forms.CharField(
+ label=_("Details on protection"), 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)
+ 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_state = forms.MultipleChoiceField(
+ label=_("Current states"), choices=[], widget=widgets.Select2Multiple,
+ required=False
+ )
period = forms.MultipleChoiceField(
label=_("Periods"), choices=[], widget=widgets.Select2Multiple,
required=False)
@@ -1364,7 +1394,8 @@ class SiteForm(CustomForm, ManageOldType):
required=False)
discoverer = forms.IntegerField(
widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-person-permissive'), associated_model=Person),
+ reverse_lazy('autocomplete-person-permissive'), associated_model=Person,
+ new=True),
label=_("Discoverer"), required=False)
HEADERS['town'] = FormHeader(_("Localization"))
town = widgets.Select2MultipleField(
@@ -1383,17 +1414,32 @@ class SiteForm(CustomForm, ManageOldType):
widget=forms.Textarea, required=False
)
+ HEADERS["editor"] = FormHeader(_("Sheet"))
+ editor = widgets.Select2MultipleField(
+ label=_("Editors"), required=False,
+ model=models.Author, remote=True, new=True
+ )
+
TYPES = [
FieldType('type', models.SiteType, True),
FieldType('period', models.Period, True),
FieldType('remain', models.RemainType, True),
FieldType('cultural_attribution',
models.CulturalAttributionType, True),
+ FieldType('heritage_interest', models.HeritageInterestType, True),
+ FieldType('heritage_environmental_protection',
+ models.HeritageAndEnvironmentalProtectionType, True),
FieldType('nature_of_site', models.NatureOfSiteType),
FieldType('interpretation_level', models.InterpretationLevelType),
- FieldType('current_status', models.SiteCurrentStatusType),
+ FieldType('current_state', models.SiteCurrentStatusType, True),
FieldType('discovery_status', models.SiteDiscoveryStatusType),
]
+ OPTIONS_PERMISSIONS = [
+ # field name, permission, options
+ ("actor", ("ishtar_common.add_qualifiedbiographicalnote",), {"new": True}),
+ ("discoverer", ("ishtar_common.add_person",), {"new": True}),
+ ("editor", ("ishtar_common.add_author",), {"new": True}),
+ ]
def clean_reference(self):
reference = self.cleaned_data['reference']
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index cb9a2ab86..d2f6861ed 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -426,7 +426,7 @@ class ArchaeologicalSite(
("towns__areas__label", _("Area")),
("towns__areas__parent__label", _("Extended area")),
("discovery_status__label", _("Discovery status")),
- ("current_status__label", _("Current status")),
+ ("current_states__label", _("Current states")),
("nature_of_site__label", _("Nature of site")),
("interpretation_level__label", _("Interpretation level")),
("heritage_interests__label", _("Heritage interest")),