16👍
✅
You’ve forgotten to set the metaclass:
class BaseEncryptedField(models.CharField):
__metaclass__ = models.SubfieldBase
... etc ...
As the documentation explains, to_python
is only called when the SubfieldBase metaclass is used.
Source:stackexchange.com