-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering not supported? #44
Comments
I too am wondering how to query against an encrypted field. I am thinking it could make sense to query using the encrypted value (perhaps with raw sql). In other words, maybe I could figure out what is actually in the DB table, and query for that value. There doesn't seem to be a clean way to figure out the encrypted value residing in the database. Any ideas? |
You could do |
I'm trying: |
This workaround is working, but it's a litle bit ugly. Note that it basically makes a guess about the mechanics of the random-padding.
EDIT: |
I belive there should be a way to do it right. But encrypted field's code was contributed and I'm unaware in it's details and don't use encrypted fields. But will be glad to accept a pull request with fix and a test for it (tests are in the |
Oh, and probably I shoudl setup a travis to run these tests automatically. Will add this in my TODO :) |
https://github.com/svetlyak40wt/django-fields/blob/master/src/django_fields/fields.py#L55 This is my be the reason why filtering is not supported here.
self.iv is different on every instantiation of this class, which causes the encrypted value changes. |
I was getting some strange behavior on my site and traced the problem back to this:
ss_num
looks like this in the model defintion:Does this library not support filtering? That'd be understandable, but if so it should make that clear in the docs and not fail silently.
Thanks for putting this out there!
The text was updated successfully, but these errors were encountered: