summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-01-18 11:36:19 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:40:54 +0200
commitf7fc18c5267d745ab754be0039967f53468a3665 (patch)
tree564af9db675d6b4b6e87c60954665a84b9147483 /ishtar_common/wizards.py
parenta7977d70f31e1c7b8dbb2c6766124d608d889709 (diff)
downloadIshtar-f7fc18c5267d745ab754be0039967f53468a3665.tar.bz2
Ishtar-f7fc18c5267d745ab754be0039967f53468a3665.zip
✨ GDPR: manage merge action, admin consultation, edition, delete, ✅ GDPR tests
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index e8be78932..a3f6689dc 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -50,7 +50,8 @@ from django.utils.safestring import mark_safe
from ishtar_common import models, models_rest
from ishtar_common.forms import CustomForm, reverse_lazy
-from ishtar_common.utils import get_all_field_names, MultiValueDict, put_session_message
+from ishtar_common.utils import get_all_field_names, get_person_gdpr_log, MultiValueDict, \
+ put_session_message
logger = logging.getLogger(__name__)
@@ -1938,6 +1939,15 @@ class PersonWizard(Wizard):
wizard_done_window = reverse_lazy("show-person")
redirect_url = "person_modification"
+ def save_model(self, dct, m2m, whole_associated_models, form_list, return_object):
+ obj = self.get_current_saved_object()
+ creation = not obj
+ returned = super().save_model(dct, m2m, whole_associated_models, form_list, return_object)
+ q = self.model.objects.filter(pk=self.current_object.pk)
+ action = "new_item" if creation else "modify_item"
+ get_person_gdpr_log(action, self.request, "", q)
+ return returned
+
class PersonModifWizard(PersonWizard):
modification = True
@@ -1954,6 +1964,11 @@ class PersonDeletionWizard(MultipleDeletionWizard):
"final-person_deletion": "ishtar/wizard/wizard_person_deletion.html"
}
+ def done(self, form_list, **kwargs):
+ q = self.model.objects.filter(pk__in=[o.pk for o in self.get_current_objects()])
+ get_person_gdpr_log("delete_item", self.request, "", q)
+ return super().done(form_list, **kwargs)
+
class IshtarUserDeletionWizard(MultipleDeletionWizard):
model = models.IshtarUser