diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-03-24 17:20:43 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-03-25 15:10:38 +0100 |
| commit | 357b31ed1526b0627e1fae90ae261a46ee28e322 (patch) | |
| tree | 8a976135beffab07f1a1b0d3106c96a85b8f916c /archaeological_operations | |
| parent | bd00a0b3db9b795907d709d163f7e8217f7c7671 (diff) | |
| download | Ishtar-357b31ed1526b0627e1fae90ae261a46ee28e322.tar.bz2 Ishtar-357b31ed1526b0627e1fae90ae261a46ee28e322.zip | |
✨ qualified biographical note/site actors - autocomplete forms and actor form
Diffstat (limited to 'archaeological_operations')
| -rw-r--r-- | archaeological_operations/forms.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index ba59f4419..f25d9f2cc 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -31,7 +31,6 @@ from django.core import validators from django.db.models import Max from django.forms.formsets import formset_factory, DELETION_FIELD_NAME, \ TOTAL_FORM_COUNT -from django.utils.functional import lazy from django.utils.safestring import mark_safe from ishtar_common.utils import gettext_lazy as _, pgettext_lazy, parse_parcels @@ -46,9 +45,7 @@ from ishtar_common.forms import FinalForm, FormSet, \ from ishtar_common.forms_common import TownFormSet, get_town_field, TownForm from ishtar_common.models import valid_id, valid_ids, Person, Town, \ DocumentTemplate, Organization, get_current_profile, \ - person_type_pks_lazy, person_type_pk_lazy, organization_type_pks_lazy, \ - organization_type_pk_lazy, SpatialReferenceSystem, Area, \ - get_sra_agent_label, get_sra_agent_head_scientist_label, get_operator_label + SpatialReferenceSystem, Area, QualifiedBiographicalNote from ishtar_common.wizards import MultiValueDict from .widgets import ParcelWidget, SelectParcelWidget, OAWidget @@ -1316,6 +1313,7 @@ class SiteForm(CustomForm, ManageOldType): 'spatial_reference_system': SpatialReferenceSystem, 'cultural_attribution': models.CulturalAttributionType, 'collaborator': Person, + "actor": QualifiedBiographicalNote, 'discoverer': Person, "nature_of_site": models.NatureOfSiteType, "interpretation_level": models.InterpretationLevelType, @@ -1324,7 +1322,10 @@ class SiteForm(CustomForm, ManageOldType): "town": Town, "type": models.SiteType, } - base_models = ["period", "remain", "collaborator", "cultural_attribution", "town", "type"] + extra_form_modals = ["qualifiedbiographicalnote", "biographicalnote", "person", + "organization"] + base_models = ["period", "remain", "collaborator", "cultural_attribution", "town", + "type", "actor"] pk = forms.IntegerField(required=False, widget=forms.HiddenInput) reference = forms.CharField(label=_("Reference"), max_length=200) @@ -1332,7 +1333,11 @@ class SiteForm(CustomForm, ManageOldType): other_reference = forms.CharField(label=_("Other reference"), required=False) collaborator = widgets.Select2MultipleField( - model=Person, label=_("Collaborators"), required=False, remote=True) + model=Person, label=_("Collaborators"), required=False, + remote=True, new=True) + actor = widgets.Select2MultipleField( + model=QualifiedBiographicalNote, label=_("Actors"), 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, @@ -1390,11 +1395,6 @@ class SiteForm(CustomForm, ManageOldType): FieldType('discovery_status', models.SiteDiscoveryStatusType), ] - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - if 'collaborator' in self.fields: - self.fields['collaborator'].widget.attrs['full-width'] = True - def clean_reference(self): reference = self.cleaned_data['reference'] q = models.ArchaeologicalSite.objects.filter(reference=reference) |
