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.py22
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)