I'm using Django 1.4, python 2.7. I want to encrypt data when it gets inserted into DB and decrypt it when I'm reading it from DB. I can override the Save method of each model to store encrypted data but I don't know what should I do when I want to read this data. I have to handle admin site model and my project's models. Which method should I override?
-
i think best way is overwrite django Model with new name like EncryptModel this is for one field example Encrypting Database Data in Django | Tyler Lesmann -> tylerlesmann.com/2008/dec/19/encrypting-database-data-djangoMohammad Efazati– Mohammad Efazati2012-08-09 21:42:07 +00:00Commented Aug 9, 2012 at 21:42
-
But which method in the model should I overwrite? what is the main method that handles reading data from db?Marjan– Marjan2012-08-10 20:42:43 +00:00Commented Aug 10, 2012 at 20:42
-
How can I override get method in django Model? - Stack Overflow -> stackoverflow.com/questions/2492653/…Mohammad Efazati– Mohammad Efazati2012-08-11 06:25:10 +00:00Commented Aug 11, 2012 at 6:25
Add a comment
|
1 Answer
The EncryptedTextField and EncryptedCharField from django-extensions seem like the things you're looking for.