Since the field is always treated as TextField, we should return an empty string rather than None for those model fields that are not nullable.

This commit is contained in:
Scott Pashley 2024-10-23 15:11:51 +01:00
parent 755636a27a
commit dcc42c9326

View file

@ -54,7 +54,7 @@ class EncryptedFieldMixin(object):
if not isinstance(value, str):
value = str(value)
return self.f.encrypt(bytes(value, "utf-8")).decode("utf-8")
return None
return ""
def get_db_prep_value(self, value, connection, prepared=False):
if not prepared: