@@ -62,25 +62,29 @@ create and manipulate instances of the data just like any other Django model
6262data. The fields will automatically handle encryption and decryption, ensuring
6363that sensitive data is stored securely in the database.
6464
65- From an encrypted client, enter the secure data::
65+ .. TODO
66+
67+ .. code-block :: console
6668
69+ $ python manage.py shell
6770 >>> from myapp.models import Patient, PatientRecord, Billing
6871 >>> billing = Billing(cc_type="Visa", cc_number="4111111111111111")
69- >>> patient_record = PatientRecord(ssn="123-45-6789", billing=self. billing)
72+ >>> patient_record = PatientRecord(ssn="123-45-6789", billing=billing)
7073 >>> patient = Patient.objects.create(
7174 patient_name="John Doe",
7275 patient_id=123456789,
73- patient_record=self. patient_record,
76+ patient_record=patient_record,
7477 )
7578
76- From an unencrypted client, you can still access the data, but the sensitive
77- fields will be encrypted. For example, if you try to access the ``ssn `` field
78- from an unencrypted client, you will see the encrypted value::
79+ .. code-block :: console
7980
80- from myapp.models import Patient
81+ >>> john = Patient.objects.get(name="John Doe")
82+ >>> john.patient_record.ssn
83+ '123-45-6789'
84+
85+ .. code-block :: console
8186
82- >>> bob = Patient.objects.get(name="Bob")
83- >>> bob.patient_record.ssn
87+ >>> john.patient_record.ssn
8488 Binary(b'\x0e\x97sv\xecY\x19Jp\x81\xf1\\\x9cz\t1\r\x02...', 6)
8589
8690 Querying encrypted fields
0 commit comments