Open desertSniper87 opened 4 years ago
Try to use laziness from django.utils.functional import lazy; medicine = lazy(encrypt(models.ForeignKey(to='assessment.Medication', on_delete=models.CASCADE)))
I don't think it will work to encrypt foreignkeys; django relies on them for all kinds of database optimizations. General advice is to encrypt all the PII that might make knowledge of the foreignkey'd ID personally identifiable. Encrypting the sensitive data means that you shouldn't have to encrypt metadata.
How do I encrypt
ForeignKey
fields? I have tried something like this:medicine = encrypt(models.ForeignKey(to='assessment.Medication', on_delete=models.CASCADE))
But I am getting errors which is encountered during circular import.
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
Full error: