georgemarshall / django-cryptography

Easily encrypt data in Django
https://django-cryptography.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
371 stars 70 forks source link

Unable to search/query on fields that uses django-cryptography #41

Closed ycv005 closed 4 years ago

ycv005 commented 4 years ago

Hey there, I am making Note apps which store people's notes. Now, I have used a text field on the Note model. Now, if someone on-page, is supposed to search for 'keyword' then getting the following error appears- Unsupported lookup 'icontains' for EncryptedTextField or join on the field not permitted, perhaps you meant icontains or contains?

Here is the queryset which I have used- queryset = Note.objects.filter( Q(title__icontains=query) | Q(tags__name__icontains=query) | Q(text__icontains=query) ).distinct()

Here is the particular field from the model- text = encrypt(models.TextField(null=True,blank=True))

georgemarshall commented 4 years ago

Please look into the comments of #10.