1👍
✅
I don’t think there’s an easy way to force Django to add something into a query content.
You may want to simply write a raw SQL query within the Django to get objects filtered with case-sensitive comparison and then use them in normal queries.
The other approach is to use Django case-sensitive filters in order to achieve the same result. E.g. contains
/startswith
both use BINARY LIKE
and may be used while comparing two strings with the same length (like a password hash)). Finally, you can use regexp
to do the case-sensitive comparison. But these are rather ugly methods in that situation. They have an uncessary overhead and you should avoid them as long as it’s possible.
Source:stackexchange.com