Skip to content

Commit

Permalink
Merge branch 'binary' into 'master'
Browse files Browse the repository at this point in the history
Don't convert binary to text

See merge request oss/djfernet!4
  • Loading branch information
jpic committed Feb 13, 2022
2 parents 86ca09f + acc747d commit c04fb4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fernet_fields/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,6 @@ class EncryptedDateTimeField(EncryptedField, models.DateTimeField):


class EncryptedBinaryField(EncryptedField, models.BinaryField):
pass
def from_db_value(self, value, expression, connection, *args):
if value is not None:
return self.to_python(self.fernet.decrypt(bytes(value)))

0 comments on commit c04fb4f

Please sign in to comment.