I know you can override delete and save methods in DJango models, but can you override a select query somehow to intercept and change a parameter slightly. I have a hashed value I want to check for, and would like to keep the hashing internal to the model.
Share
You don’t make it absolutely clear what you want to do, but I think there are two possibilities here.
The general way to override the database query is to define a custom Manager, and override
get_query_setmethod. You can add extra filtering criteria here.However, if I understand your question properly, you are trying to change the query for a particular field only. In this case, I think the better answer is to define a custom Field. Here you can override
get_db_prep_lookupwhich allows you to customise the value that is used in the database lookup.