diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-19 13:40:35 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-28 11:40:17 +0100 |
commit | 72593b0dabfba41e5da8e5b7e1f6c786b58ba151 (patch) | |
tree | df8ce0731ca3bc33727198d355c2c0aa0ab72169 /archaeological_finds/models_finds.py | |
parent | eb9d989822c4314bb36d2b8179a598c8b9f2b9c9 (diff) | |
download | Ishtar-72593b0dabfba41e5da8e5b7e1f6c786b58ba151.tar.bz2 Ishtar-72593b0dabfba41e5da8e5b7e1f6c786b58ba151.zip |
Find wizard: manage a simplified form for find with many base finds
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 9 |
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 |