Skip to content

Commit

Permalink
fix EncryptedJSONField field for Django 3
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tordoff committed Aug 16, 2022
1 parent e786a3d commit 9449c15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion osf/utils/fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import jwe
import json
from django.db import models
from django.contrib.postgres.fields.jsonb import JSONField
from website import settings
Expand Down Expand Up @@ -96,7 +97,7 @@ def get_prep_value(self, value, **kwargs):
def to_python(self, value):
value = rapply(value, decrypt_string, prefix=self.prefix)
if value:
value = value.decode()
value = json.loads(value.decode())
return super(EncryptedJSONField, self).to_python(value)

def from_db_value(self, value, expression, connection):
Expand Down

0 comments on commit 9449c15

Please sign in to comment.