Compare commits

...

1 Commits

Author SHA1 Message Date
ibuler
000bb100cd perf: try to decrypt then origin value 2025-08-29 11:00:19 +08:00

View File

@@ -144,6 +144,10 @@ class EncryptMixin:
return value
plain_value = Encryptor(value).decrypt()
# 如果解密失败,则使用原来的值
if not plain_value:
plain_value = value
# 可能和Json mix所以要先解密再json
sp = super()
if hasattr(sp, "from_db_value"):
@@ -166,9 +170,6 @@ class EncryptMixin:
class EncryptTextField(EncryptMixin, models.TextField):
description = _("Encrypt field using Secret Key")
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class EncryptCharField(EncryptMixin, models.CharField):
@staticmethod