diff options
-rw-r--r-- | archaeological_context_records/models.py | 5 | ||||
-rw-r--r-- | archaeological_files/models.py | 4 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 23 | ||||
-rw-r--r-- | archaeological_finds/models_treatments.py | 1 | ||||
-rw-r--r-- | archaeological_operations/models.py | 16 | ||||
-rw-r--r-- | ishtar_common/models.py | 13 |
6 files changed, 43 insertions, 19 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 9533f357a..0c245abd4 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -528,6 +528,11 @@ class ContextRecord( ] ) STATISTIC_MODALITIES = [key for key, lbl in STATISTIC_MODALITIES_OPTIONS.items()] + GET_VALUES_M2M = [ + "documentations", + "cultural_attributions", + "excavation_technics", + ] # search parameters EXTRA_REQUEST_KEYS = { diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 2fcd9bc47..c5e9399c4 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -417,6 +417,10 @@ class File( ("total_developed_surface", (_("Total developed surface (km2)"), 0.000001)), ) ) + GET_VALUES_M2M = [ + "towns", + "departments", + ] # search parameters BOOL_FIELDS = BaseHistorizedItem.BOOL_FIELDS + ["end_date__isnull"] diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 7ce184fc0..5f8c30701 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1950,17 +1950,24 @@ class Find( ] GET_VALUES_EXTRA = ValueGetter.GET_VALUES_EXTRA + ["complete_id", "context_record_label"] - GET_VALUES_EXTRA_TYPES = ValueGetter.GET_VALUES_EXCLUDE_FIELDS + [ - "material_types", - "object_types", - "functional_areas", - "integrities", - "remarkabilities", - "communicabilities", - "preservation_to_considers", + GET_VALUES_M2M = [ "alterations", "alteration_causes", + "communicabilities", "conservatory_states", + "cultural_attributions", + "functional_areas", + "material_types", + "integrities", + "preservation_to_considers", + "museum_former_collections", + "museum_inventory_marking_presence", + "museum_marking_type", + "object_types", + "preservation_to_considers", + "remarkabilities", + "technical_areas", + "technical_processes", ] CACHED_LABELS = [ "cache_complete_museum_id", diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index eb149b0de..168c87e2f 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -196,6 +196,7 @@ class Treatment( SearchVectorConfig("upstream__cached_label"), ] PARENT_SEARCH_VECTORS = ["person", "organization"] + GET_VALUES_M2M = ["treatment_types"] objects = ExternalIdManager() label = models.CharField(_("Label"), blank=True, null=True, max_length=200) diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index d012b0088..7e3b0254f 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -340,6 +340,13 @@ class ArchaeologicalSite( SearchVectorConfig("towns__numero_insee", "raw"), ] PARENT_ONLY_SEARCH_VECTORS = ["operations"] + GET_VALUES_M2M = [ + "periods", + "remains", + "cultural_attributions", + "towns", + "collaborators", + ] DATED_FIELDS = BaseHistorizedItem.DATED_FIELDS + ["sinking_date"] NUMBER_FIELDS = GeographicTownItem.NUMBER_FIELDS[:] @@ -1024,6 +1031,15 @@ class Operation( "finds_deposit_date", ] NUMBER_FIELDS = ["year", "operation_code"] + GeographicTownItem.NUMBER_FIELDS + + GET_VALUES_M2M = [ + "collaborators", + "remains", + "towns", + "periods", + "cultural_attributions", + ] + EXTRA_REQUEST_KEYS = { "operation_type__label": "operation_type__label", "common_name": "common_name__icontains", diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 231d073e3..def056425 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -269,16 +269,7 @@ class ValueGetter: "point", "history_m2m", ] - GET_VALUES_ = [ - "preservation_to_considers", - "alterations", - "alteration_causes", - ] - GET_VALUES_EXTRA_TYPES = [ - "preservation_to_considers", - "alterations", - "alteration_causes", - ] + GET_VALUES_M2M = [] def _get_values_documents(self, prefix="", filtr=None): values = {} @@ -365,7 +356,7 @@ class ValueGetter: for key, val in values.items(): if val is None: val = "" - elif (key in self.GET_VALUES_EXTRA_TYPES or "type" in key) and ( + elif (key in self.GET_VALUES_M2M or "type" in key) and ( val.__class__.__name__.split(".")[0] == "ManyRelatedManager" ): val = " ; ".join(str(v) for v in val.all()) |