summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-10-17 15:05:03 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:19 +0100
commit4d2730f4003347eab7c25a5f0b3f01918e522d5a (patch)
tree67ba67af8d87a8479d4d53f4c3aaec55fc39e9d9 /archaeological_context_records/models.py
parent5a09ae075099e2cf6f509947daaf73074c7822fe (diff)
downloadIshtar-4d2730f4003347eab7c25a5f0b3f01918e522d5a.tar.bz2
Ishtar-4d2730f4003347eab7c25a5f0b3f01918e522d5a.zip
Context records: Excavation technic become many2many
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py19
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