Skip to content

Commit

Permalink
add FIELDS_TO_REDACT list to model
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Oct 10, 2023
1 parent 638359c commit 45787b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 1 addition & 6 deletions lemarche/www/tenders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"

Expand Down

0 comments on commit 45787b9

Please sign in to comment.