Skip to content

Commit

Permalink
Fix bug in display output
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorodgerbrown committed Sep 27, 2023
1 parent f754ca2 commit d6e4897
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion anonymiser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ def is_field_redaction_auto(self, field: models.Field) -> bool:
"""
Return True if the field should be auto-redacted.
Return False if the class-level auto_redact attr is False.
Currently this includes text fields that are not choices, primary
keys, unique fields, or in the auto_redact_exclude list.
"""
return (
isinstance(field, (models.CharField, models.TextField))
self.auto_redact
and isinstance(field, (models.CharField, models.TextField))
and not field.choices
and not field.primary_key
and not getattr(field, "unique", False)
Expand Down

0 comments on commit d6e4897

Please sign in to comment.