From 4b22b3a77938aaec4c21c921c90e922fe526c43c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 6 Oct 2022 15:08:00 +0200 Subject: Geodata: cascade add --- archaeological_operations/models.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 13b784539..7ba14a786 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -75,7 +75,8 @@ from ishtar_common.models import ( MainItem, HierarchicalType, ) -from ishtar_common.models_common import Department, GeoVectorData, HistoricalRecords +from ishtar_common.models_common import Department, GeoVectorData, HistoricalRecords,\ + geodata_attached_changed from ishtar_common.model_managers import UUIDModelManager from ishtar_common.utils import ( cached_label_changed, @@ -779,6 +780,7 @@ post_save.connect(site_post_save, sender=ArchaeologicalSite) m2m_changed.connect( document_attached_changed, sender=ArchaeologicalSite.documents.through ) +m2m_changed.connect(geodata_attached_changed, sender=ArchaeologicalSite.geodata.through) for attr in ArchaeologicalSite.HISTORICAL_M2M: m2m_changed.connect( @@ -976,12 +978,11 @@ class Operation( "code_patriarche": "Code patriarche", "associated_file_short_label": _("Associated file (label)"), "operator__name": _("Operator name"), - "scientist__raw_name": _("Scientist (full name)"), "associated_file__external_id": _("Associated file (external ID)"), "scientist__title": _("Scientist (title)"), "scientist__surname": _("Scientist (surname)"), "scientist__name": _("Scientist (name)"), - "scientist__raw_name": _("Scientist in charge"), + "scientist__raw_name": _("Scientist (full name)"), "scientist__attached_to__name": _("Scientist - Organization (name)"), "in_charge__title": _("Scientific monitor (title)"), "in_charge__surname": _("Scientific monitor (surname)"), @@ -1516,6 +1517,9 @@ class Operation( def __str__(self): return self.cached_label or "" + def geodata_child_item_queries(self): + return [self.context_record] + DOC_VALUES = [ ("context_records", _("List of associated context records")), ("containers", _("List of associated containers")), @@ -2205,6 +2209,7 @@ class Operation( m2m_changed.connect(force_cached_label_changed, sender=Operation.towns.through) m2m_changed.connect(document_attached_changed, sender=Operation.documents.through) +m2m_changed.connect(geodata_attached_changed, sender=Operation.geodata.through) for attr in Operation.HISTORICAL_M2M: m2m_changed.connect( -- cgit v1.2.3