Comment by squeaky-clean
6 years ago
Also a good way to prevent hashed passwords from being accidentally logged.
Class PasswordType(django.db.models.Field):
hashed_pw = CharField()
def __str__():
# you can even raise an Exception here
return '<confidential data>'
Not that you should be trying to log this stuff anyways, but unless you're a solo dev you can't prevent other people from creating bugs, but you can mitigate common scenarios.
No comments yet
Contribute on Hacker News ↗