diff options
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 17 |
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 |