jazzband / django-fernet-encrypted-fields

MIT License
47 stars 9 forks source link

Fix for Error saving model in django admin #5

Closed StevenMapes closed 2 years ago

StevenMapes commented 2 years ago

This PR fixes #4 by creating an assigning a semaphore property during the clean methods invocation. This semaphore is used by the to_python method to indicate that the value has already run through decryption. The property is then cleaned up before the results are returned.

Please see issue 4 for another way of performing by just overloading the clean method but this way if Django add any new functionality into the base fields clean method that will still be called to it's less intrusive and less likely to cause issues in the future