diff options
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 08e94af85..97a629d05 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -529,7 +529,7 @@ class ContextRecord( ("datings__period__label", _("Period")), ("identification__label", _("Identification")), ("activity__label", _("Activity")), - ("excavation_technic__label", _("Excavation technique")), + ("excavation_technics__label", _("Excavation technique")), ("documents__source_type__label", _("Associated document type")), ("last_modified__year", _("Modification (year)")), ] @@ -620,9 +620,9 @@ class ContextRecord( pgettext_lazy("key for text search", "record-relation-type"), "cr_relation_types", ), - "excavation_technic": SearchAltName( + "excavation_technics": SearchAltName( pgettext_lazy("key for text search", "excavation-technique"), - "excavation_technic__label__iexact", + "excavation_technics__label__iexact", ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) @@ -640,9 +640,11 @@ class ContextRecord( SearchVectorConfig("datings_comment", "local"), SearchVectorConfig("identification__label"), SearchVectorConfig("activity__label"), - SearchVectorConfig("excavation_technic__label"), ] - M2M_SEARCH_VECTORS = [SearchVectorConfig("datings__period__label", "local")] + M2M_SEARCH_VECTORS = [ + SearchVectorConfig("datings__period__label", "local"), + SearchVectorConfig("excavation_technics__label", "local"), + ] UP_MODEL_QUERY = { "operation": ( pgettext_lazy("key for text search", "operation"), @@ -656,7 +658,7 @@ class ContextRecord( ("site", "archaeological_site__pk"), ("file", "operation__associated_file__pk"), ] - HISTORICAL_M2M = ["datings", "documentations"] + HISTORICAL_M2M = ["datings", "documentations", "excavation_technics"] CACHED_LABELS = ["cached_label", "cached_periods", "cached_related_context_records"] DOWN_MODEL_UPDATE = ["base_finds"] @@ -808,12 +810,11 @@ class ContextRecord( on_delete=models.SET_NULL, verbose_name=_("Activity"), ) - excavation_technic = models.ForeignKey( + excavation_technics = models.ManyToManyField( ExcavationTechnicType, blank=True, - null=True, - on_delete=models.SET_NULL, verbose_name=_("Excavation technique"), + related_name="context_records", ) related_context_records = models.ManyToManyField( "ContextRecord", through="RecordRelations", blank=True |