Skip to content

Commit

Permalink
Merge pull request #1 from Airbase/SM-psycopg3
Browse files Browse the repository at this point in the history
Add support for psycopg3
  • Loading branch information
sidmitra authored May 9, 2024
2 parents 9056d4b + 523e51f commit c4740d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fernet_fields/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ class EncryptedEmailField(EncryptedField, models.EmailField):


class EncryptedIntegerField(EncryptedField, models.IntegerField):
pass
def get_db_prep_save(self, value, connection):
if value is not None:
retval = self.fernet.encrypt(force_bytes(value))
return connection.Database.Binary(retval)


class EncryptedDateField(EncryptedField, models.DateField):
Expand Down

0 comments on commit c4740d5

Please sign in to comment.