[Solved]-Custom field's to_python not working? – Django

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.

Leave a comment