summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-09-20 14:55:11 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-09-20 15:47:14 +0200
commitdf7b7527db7936d9a5014cd121525a36dbf57531 (patch)
treebca9afb0099135323ffe3c135f421b268f20fa0d
parent038d2ddee75aaccf0ad0c60d66efe09de69958e8 (diff)
downloadIshtar-df7b7527db7936d9a5014cd121525a36dbf57531.tar.bz2
Ishtar-df7b7527db7936d9a5014cd121525a36dbf57531.zip
✨ context records, finds search: add new fields
-rw-r--r--archaeological_context_records/forms.py6
-rw-r--r--archaeological_context_records/models.py9
-rw-r--r--archaeological_finds/forms.py2
-rw-r--r--archaeological_finds/models_finds.py4
-rw-r--r--archaeological_operations/models.py3
-rw-r--r--ishtar_common/views_item.py1
6 files changed, 22 insertions, 3 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index fe6534ea8..057d2996d 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -157,6 +157,12 @@ class RecordSelect(GeoItemSelect, PeriodSelect):
label=_("Search within related operations"), choices=[]
)
unit = forms.ChoiceField(label=_("Type"), choices=[])
+ excavator = forms.IntegerField(
+ label=_("Excavator"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-person'),
+ associated_model=Person),
+ validators=[valid_id(Person)], required=False)
activity = forms.ChoiceField(label=_("Activity"), choices=[])
identifications = forms.ChoiceField(label=_("Identification"), choices=[])
cultural_attributions = forms.ChoiceField(
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index a832e2476..efef8cce0 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -608,7 +608,8 @@ class ContextRecord(
"archaeological_sites": "operation__archaeological_sites__pk",
"cached_label": "cached_label__icontains",
"datings__period__label": "datings__period__label",
- "operation_id": "operation_id",
+ "operation_id": "operation_id", # dynamic_table_documents
+ "excavator_id": "excavator_id", # dynamic_table_documents
"unit__label": "unit__label",
}
MANY_COUNTED_FIELDS = ["base_finds__isnull"]
@@ -733,6 +734,10 @@ class ContextRecord(
pgettext_lazy("key for text search", "color-details"),
"details_on_color__iexact"
),
+ "excavator": SearchAltName(
+ pgettext_lazy("key for text search", "excavator"),
+ "excavator__cached_label__iexact",
+ ),
}
ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES)
ALT_NAMES.update(DocumentItem.ALT_NAMES)
@@ -751,7 +756,7 @@ class ContextRecord(
SearchVectorConfig("datings_comment", "local"),
SearchVectorConfig("unit__label"),
SearchVectorConfig("activity__label"),
- SearchVectorConfig("excavator__raw_name", "raw"),
+ SearchVectorConfig("excavator__cached_label", "raw"),
]
M2M_SEARCH_VECTORS = [
SearchVectorConfig("datings__period__label", "local"),
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index b04276155..094e6be21 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -1804,6 +1804,7 @@ class FindSelect(GeoItemSelect, PeriodSelect):
)
description = forms.CharField(label=_("Description"))
+ base_finds__discovery_method = forms.ChoiceField(label=_("Discovery method"), choices=[])
base_finds__comment = forms.CharField(label=_("Base find - Comment on the circumstances of discovery"))
base_finds__discovery_date = DateField(label=_("Discovery date (exact or beginning)"))
base_finds__discovery_date_taq = DateField(label=_("Discovery date (end)"))
@@ -1978,6 +1979,7 @@ class FindSelect(GeoItemSelect, PeriodSelect):
FieldType("preservation_to_considers", models.TreatmentType),
FieldType("integrities", models.IntegrityType),
FieldType("remarkabilities", models.RemarkabilityType),
+ FieldType("base_finds__discovery_method", models.DiscoveryMethod),
FieldType("base_finds__context_record__town__areas", Area),
FieldType(
"base_finds__context_record__operation__operation_type", OperationType
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 42b1aa514..9ad128432 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -1599,6 +1599,10 @@ class Find(
pgettext_lazy("key for text search", "dimensions-comment"),
"dimensions_comment__iexact",
),
+ "base_finds__discovery_method": SearchAltName(
+ pgettext_lazy("key for text search", "discovery-method"),
+ "base_finds__discovery_method__label__iexact",
+ ),
"base_finds__topographic_localisation": SearchAltName(
pgettext_lazy("key for text search", "topographic-localisation"),
"base_finds__topographic_localisation__iexact",
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 2f3cae888..fcfbb5e54 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -418,10 +418,11 @@ class ArchaeologicalSite(
EXTRA_REQUEST_KEYS = {
"towns_label": "towns",
- "collaborators__pk": "collaborators__pk", # dynamic_table_documents
"cached_towns_label": "cached_towns_label",
"cached_periods": "cached_periods",
"cached_remains": "remains",
+ "collaborators__pk": "collaborators__pk", # dynamic_table_documents
+ "discoverer_id": "discoverer_id", # dynamic_table_documents
}
# alternative names of fields for searches
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 6c95b130c..0ad158de6 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -121,6 +121,7 @@ LIST_FIELDS = { # key: hierarchic depth
"development_type": HIERARCHIC_LEVELS,
"monitoring_justification": HIERARCHIC_LEVELS,
"types": HIERARCHIC_LEVELS,
+ "discovery_method": 0,
"discovery_status": 0,
"current_status": 0,
"nature_of_site": 0,