summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 3483113d7..1fb4f6132 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -327,6 +327,15 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms):
finds = self.find.filter().order_by("-order").all()
return finds and finds[0]
+ def get_main_find(self):
+ """
+ Get the last find which is not related to many base_find
+ """
+ for find in self.find.order_by('-pk'):
+ if find.base_finds.count() == 1:
+ return find
+ return
+
def generate_index(self):
"""
Generate index based on operation or context record (based on