I’m so new in Django and if I am asking a stupid question, so sorry. But is it possible to reach encrypt_util.py file from index.html?
I just want to decrypt one field, so that I can show the encrypted data saved in the database to the user as normal format. That’s why I need to call encrypt_util.py file to use decrypt function in index.html. Thanks in advance.
In encrypt_util.py, I have two functions; encrypt(password) and decrypt(password). I encrypt one field(patientid) value I received via POST and save it to the database in views.py. No problem here. And I am sending this value as json format with serializer.py and display it in datatable(In my case, it is displayed encrypted). I want to decrypt it in server side. After sending encrypted data to server side in json format, I need to decrypt this data. However, I cannot call the decrypt function at this stage. I dont know how to pass decrypt function to my index.html which is in templates.
I have one more question. Is it safer to decrypt the encrypted data again in views.py and pass it to index.html as you have said, or to decrypt this information in the server side, that is, index.html and display it on the datatable?
Note: I can of course call those two functions in views.py but no idea how to pass that function to template in the context.
I mean, I encrypt the patientid data I received via POST in views.py and save it to the database. In order to display that patientid data in datatable, I need to decrypt it.
My question is that it is a good way to decrypt patientid in views.py and pass the result to index.html, or passing encrypted patientid with json format to index.html and do decryption in index.html?
At 2nd case, I cannot pass decrypt function to index.html.