diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-05-03 12:28:46 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-05-03 16:49:12 +0200 |
commit | 4dd47534de59d7c6162a92a308dfa765ede9e6ea (patch) | |
tree | a0865fd39d6882bcd6fa0ea40e172b9dc0687368 /archaeological_operations/models.py | |
parent | 65431dd76a453aa106882669d8923d85adbd4573 (diff) | |
download | Ishtar-4dd47534de59d7c6162a92a308dfa765ede9e6ea.tar.bz2 Ishtar-4dd47534de59d7c6162a92a308dfa765ede9e6ea.zip |
✨ item deletion: better display of associated deleted items
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index eeee9e8aa..83e60866d 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1695,6 +1695,28 @@ class Operation( ) return dct + def get_deleted_data(self) -> dict: + """ + Return sub object list that will be deleted + :return: {"Sub object type": ["Sub object 1", "Sub object 2", ...]} + """ + data = {} + if self.administrative_act.count(): + lbl = str(_("Administrative act")) + data = {lbl: []} + for item in self.administrative_act.all(): + data[lbl].append(str(item)) + if self.context_record.count(): + lbl = str(_("Context record")) + data[lbl] = [] + for item in self.context_record.all(): + data[lbl].append(str(item)) + for key, value in item.get_deleted_data().items(): + if key not in data: + data[key] = [] + data[key] += value + return data + def archaeological_sites_list(self) -> list: return self.get_associated_main_item_list( "archaeological_sites", ArchaeologicalSite |