diff options
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 |