mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-09-12 09:13:08 +00:00
ReFix le AESField
This commit is contained in:
parent
ba25477e72
commit
decf57f0fe
1 changed files with 6 additions and 0 deletions
|
@ -79,6 +79,12 @@ class AESEncryptedField(models.CharField):
|
||||||
return decrypt(settings.AES_KEY,
|
return decrypt(settings.AES_KEY,
|
||||||
binascii.a2b_base64(value)).decode('utf-8')
|
binascii.a2b_base64(value)).decode('utf-8')
|
||||||
|
|
||||||
|
def from_db_value(self, value, *args, **kwargs):
|
||||||
|
if value is None:
|
||||||
|
return value
|
||||||
|
return decrypt(settings.AES_KEY,
|
||||||
|
binascii.a2b_base64(value)).decode('utf-8')
|
||||||
|
|
||||||
def get_prep_value(self, value):
|
def get_prep_value(self, value):
|
||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in a new issue