diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-16 16:24:51 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-02-05 10:51:52 +0100 |
commit | eb204af3bda0e081b796f7c3db6f9c615cc79147 (patch) | |
tree | a94ae83d669fd4e763219243e07b789adaeffff4 /ishtar_common/models.py | |
parent | 27056118d045ef7813f09ef94b16da32084de3be (diff) | |
download | Ishtar-eb204af3bda0e081b796f7c3db6f9c615cc79147.tar.bz2 Ishtar-eb204af3bda0e081b796f7c3db6f9c615cc79147.zip |
✨ GDPR: admin - log (read only, export)
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 944cbcf5d..35c59a94e 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3213,6 +3213,8 @@ GDPR_ACTIVITY = ( ("PD", _("Person deletion")), ) +GDPR_ACTIVITY_DICT = dict(GDPR_ACTIVITY) + class GDPRPerson(models.Model): person = models.ForeignKey(Person, verbose_name=_("Person"), on_delete=models.SET_NULL, @@ -3242,10 +3244,17 @@ class GDPRLog(models.Model): @property def activity_lbl(self): - gdpr_activity_dict = dict(GDPR_ACTIVITY) - if self.activity not in gdpr_activity_dict: + if self.activity not in GDPR_ACTIVITY_DICT: return str(_("Unknown activity :")) + self.activity - return gdpr_activity_dict[self.activity] + return GDPR_ACTIVITY_DICT[self.activity] + + @property + def persons_lbl(self): + return " ; ".join( + self.persons.through.objects.filter( + gdprlog_id=self.pk + ).values_list("gdprperson__raw_name", flat=True) + ) def __str__(self): return f"{self.user.username} - {self.date} - {self.activity_lbl}" |