summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_context_records/forms.py11
-rw-r--r--archaeological_context_records/models.py20
-rw-r--r--ishtar_common/views_item.py97
3 files changed, 80 insertions, 48 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index 0971fe363..f4176b619 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -159,7 +159,7 @@ class RecordSelect(GeoItemSelect, PeriodSelect):
activity = forms.ChoiceField(label=_("Activity"), choices=[])
identifications = forms.ChoiceField(label=_("Identification"), choices=[])
cultural_attributions = forms.ChoiceField(
- label=_("Cultural attribution"), choices=[], required=False)
+ label=_("Cultural attribution"), choices=[])
documentations = forms.ChoiceField(label=_("Documentation"))
description = forms.CharField(label=_("Description"))
comment = forms.CharField(label=_("General comment"))
@@ -171,6 +171,11 @@ class RecordSelect(GeoItemSelect, PeriodSelect):
label=_("Search within relations"), choices=[]
)
excavation_technics = forms.ChoiceField(label=_("Excavation techniques"), choices=[])
+ structures = forms.ChoiceField(label=_("Structure"), choices=[])
+ textures = forms.ChoiceField(label=_("Texture"), choices=[])
+ inclusions = forms.ChoiceField(label=_("Inclusions"), choices=[])
+ colors = forms.ChoiceField(label=_("Colors"), choices=[])
+ details_on_color = forms.CharField(label=_("Details on color"))
TYPES = PeriodSelect.TYPES + [
FieldType('cultural_attributions', models.CulturalAttributionType),
@@ -181,6 +186,10 @@ class RecordSelect(GeoItemSelect, PeriodSelect):
FieldType("activity", models.ActivityType),
FieldType("identifications", models.IdentificationType),
FieldType("documentations", models.DocumentationType),
+ FieldType("structures", models.StructureType),
+ FieldType("textures", models.TextureType),
+ FieldType("inclusions", models.InclusionType),
+ FieldType("colors", models.ColorType),
] + GeoItemSelect.TYPES
SITE_KEYS = {"archaeological_site": None}
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 062535e04..a10c78552 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -712,6 +712,26 @@ class ContextRecord(
pgettext_lazy("key for text search", "comment"),
"comment__iexact"
),
+ "structures": SearchAltName(
+ pgettext_lazy("key for text search", "structure"),
+ "structures__label__iexact",
+ ),
+ "textures": SearchAltName(
+ pgettext_lazy("key for text search", "texture"),
+ "textures__label__iexact",
+ ),
+ "inclusions": SearchAltName(
+ pgettext_lazy("key for text search", "inclusion"),
+ "inclusions__label__iexact",
+ ),
+ "colors": SearchAltName(
+ pgettext_lazy("key for text search", "color"),
+ "colors__label__iexact",
+ ),
+ "details_on_color": SearchAltName(
+ pgettext_lazy("key for text search", "color-details"),
+ "details_on_color__iexact"
+ ),
}
ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES)
ALT_NAMES.update(DocumentItem.ALT_NAMES)
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 2a35c85d2..728822f0c 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -99,6 +99,56 @@ CURRENT_ITEM_KEYS = (
)
CURRENT_ITEM_KEYS_DICT = dict(CURRENT_ITEM_KEYS)
+HIERARCHIC_LEVELS = 5
+
+LIST_FIELDS = { # key: hierarchic depth
+ "conservatory_states": HIERARCHIC_LEVELS,
+ "identifications": HIERARCHIC_LEVELS,
+ "material_types": HIERARCHIC_LEVELS,
+ "material_type": HIERARCHIC_LEVELS,
+ "object_types": HIERARCHIC_LEVELS,
+ "period": HIERARCHIC_LEVELS,
+ "periods": HIERARCHIC_LEVELS,
+ "source_type": HIERARCHIC_LEVELS,
+ "unit": HIERARCHIC_LEVELS,
+ "museum_collection_entry_mode": HIERARCHIC_LEVELS,
+ "shooting_angle": HIERARCHIC_LEVELS,
+ "technical_processes": HIERARCHIC_LEVELS,
+ "structures": HIERARCHIC_LEVELS,
+ "textures": HIERARCHIC_LEVELS,
+ "inclusions": HIERARCHIC_LEVELS,
+ "colors": HIERARCHIC_LEVELS,
+ "museum_inventory_marking_presence": 0,
+ "museum_marking_type": 0,
+ "museum_collection": 0,
+ "batch": 0,
+ "preservation_to_considers": 0,
+ "integrities": 0,
+ "remarkabilities": 0,
+ "checked_type": 0,
+ "material_type_quality": 0,
+ "object_type_quality": 0,
+ "communicabilities": 0,
+ "alterations": 0,
+ "alteration_causes": 0,
+ "treatment_emergency": 0,
+ "cultural_attributions": 0,
+ "remains": 0,
+ "dating_type": 0,
+ "quality": 0,
+ "operation_type": 0,
+ "report_processing": 0,
+ "record_quality_type": 0,
+ "data_type": 0,
+ "origin": 0,
+ "provider": 0,
+ "excavation_technics": 0,
+ "activity": 0,
+ "documentations": 0,
+}
+
+HIERARCHIC_FIELDS = list(LIST_FIELDS.keys())
+
def get_autocomplete_queries(request, label_attributes, extra=None):
if not label_attributes:
@@ -557,53 +607,6 @@ def revert_item(model):
return func
-HIERARCHIC_LEVELS = 5
-
-LIST_FIELDS = { # key: hierarchic depth
- "conservatory_states": HIERARCHIC_LEVELS,
- "identifications": HIERARCHIC_LEVELS,
- "material_types": HIERARCHIC_LEVELS,
- "material_type": HIERARCHIC_LEVELS,
- "object_types": HIERARCHIC_LEVELS,
- "period": HIERARCHIC_LEVELS,
- "periods": HIERARCHIC_LEVELS,
- "source_type": HIERARCHIC_LEVELS,
- "unit": HIERARCHIC_LEVELS,
- "museum_collection_entry_mode": HIERARCHIC_LEVELS,
- "shooting_angle": HIERARCHIC_LEVELS,
- "technical_processes": HIERARCHIC_LEVELS,
- "museum_inventory_marking_presence": 0,
- "museum_marking_type": 0,
- "museum_collection": 0,
- "batch": 0,
- "preservation_to_considers": 0,
- "integrities": 0,
- "remarkabilities": 0,
- "checked_type": 0,
- "material_type_quality": 0,
- "object_type_quality": 0,
- "communicabilities": 0,
- "alterations": 0,
- "alteration_causes": 0,
- "treatment_emergency": 0,
- "cultural_attributions": 0,
- "remains": 0,
- "dating_type": 0,
- "quality": 0,
- "operation_type": 0,
- "report_processing": 0,
- "record_quality_type": 0,
- "data_type": 0,
- "origin": 0,
- "provider": 0,
- "excavation_technics": 0,
- "activity": 0,
- "documentations": 0,
-}
-
-HIERARCHIC_FIELDS = list(LIST_FIELDS.keys())
-
-
def _get_values(request, val):
if hasattr(val, "all"): # manage related objects
vals = list(val.all())