From 53f899c9ded29921c982e67f220716b2f86823f3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 17 Nov 2020 15:37:22 +0100 Subject: Manage a "custom_index" for base types --- archaeological_finds/models_finds.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'archaeological_finds/models_finds.py') diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index a9f554380..9b1f43cb6 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -343,6 +343,10 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, def natural_key(self): return (self.uuid, ) + @property + def operation(self): + return self.context_record.operation + def public_representation(self): dct = super(BaseFind, self).public_representation() dct.update({ @@ -1853,6 +1857,13 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, bf.context_record.operation.get_reference(), self.index) + @property + def operation(self): + bf = self.get_first_base_find() + if not bf or not bf.context_record or not bf.context_record.operation: + return + return bf.context_record.operation + def context_records_lbl(self): return " - ".join( [bf.context_record.cached_label for bf in self.base_finds.all()] -- cgit v1.2.3