From 45787b9f0747bfff600dbf5c6ae51e1641c13680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Tue, 10 Oct 2023 16:09:43 +0200 Subject: [PATCH] add FIELDS_TO_REDACT list to model --- lemarche/tenders/models.py | 7 +++++++ lemarche/www/tenders/views.py | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lemarche/tenders/models.py b/lemarche/tenders/models.py index 9644a6b1a..2c97ecaa0 100644 --- a/lemarche/tenders/models.py +++ b/lemarche/tenders/models.py @@ -766,6 +766,13 @@ def perimeters_list_string(self) -> str: class TenderStepsData(models.Model): + FIELDS_TO_REDACT = [ + "contact-contact_email", + "contact-contact_phone", + "contact-contact_last_name", + "contact-contact_first_name", + ] + created_at = models.DateTimeField(verbose_name="Date de création", default=timezone.now) updated_at = models.DateTimeField(verbose_name="Date de modification", auto_now=True) uuid = ShortUUIDField( diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index 10f557123..ea11a18f7 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -157,12 +157,7 @@ def process_step(self, form): del data["csrfmiddlewaretoken"] # Hide personal data - for field_to_redacted in [ - "contact-contact_email", - "contact-contact_phone", - "contact-contact_last_name", - "contact-contact_first_name", - ]: + for field_to_redacted in TenderStepsData.FIELDS_TO_REDACT: if field_to_redacted in data: data[field_to_redacted] = "[REDACTED]"