summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 60f8fce1b..89f3edee4 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -254,12 +254,11 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
'label': 'label__icontains',
'archaeological_sites': 'operation__archaeological_sites__pk',
'cached_label': 'cached_label__icontains',
+ 'datings__period__label': 'datings__period__label',
+ 'operation_id': 'operation_id',
}
RELATION_TYPES_PREFIX = {'ope_relation_types': 'operation__',
'cr_relation_types': ''}
- RELATIVE_SESSION_NAMES = [
- ('operation', 'operation__pk'),
- ('file', 'operation__associated_file__pk')]
# alternative names of fields for searches
ALT_NAMES = {
'label': (
@@ -282,6 +281,10 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
pgettext_lazy("key for text search", u"operation-code"),
'operation__operation_code'
),
+ 'operation__cached_label': (
+ pgettext_lazy("key for text search", u"operation"),
+ 'operation__cached_label__icontains'
+ ),
'archaeological_site': (
pgettext_lazy("key for text search", u"site"),
'archaeological_site__cached_label__icontains'
@@ -319,7 +322,22 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
"identification__label", "activity__label",
"excavation_technic__label"]
M2M_SEARCH_VECTORS = ["datings__period__label"]
+ UP_MODEL_QUERY = {
+ "operation": (
+ pgettext_lazy("key for text search", u"operation"),
+ 'cached_label'),
+ "site": (
+ pgettext_lazy("key for text search", u"site"),
+ 'cached_label'),
+ }
+ RELATIVE_SESSION_NAMES = [
+ ('operation', 'operation__pk'),
+ ('site', 'archaeological_site__pk'),
+ ('file', 'operation__associated_file__pk'),
+ ]
+
history = HistoricalRecords()
+ objects = ExternalIdManager()
# fields
external_id = models.TextField(_(u"External ID"), blank=True, null=True)
@@ -396,7 +414,6 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
blank=True)
cached_label = models.TextField(_(u"Cached name"), null=True, blank=True,
db_index=True)
- objects = ExternalIdManager()
class Meta:
verbose_name = _(u"Context Record")