[Answer]-Django base64 field filtering

1đź‘Ť

âś…

Are you using PostgreSQL? You can add an index that is “this field base64-decoded” (see http://www.postgresql.org/docs/9.1/static/functions-string.html for base64 functions and http://www.postgresql.org/docs/9.1/static/sql-createindex.html for creating indexes). Then, in a database shell, you can practice querying against the field.

Once you know that works, you can write queries in Django using either .extra() or .raw() that can use these kind of queries. Both of these options still return normal Django result sets and, given that you’ll have indexed the field, will operate very quickly.

👤Joel Burton

Leave a comment