Everything I have read about Django indicates that ORM queries are case sensitive. However I am finding that my initial, very basic attempts at this kind of code are not case sensitive.
My model is connected to a SQL server database and I am wondering if that’s the reason for the deviation.
It’s not an issue, I prefer case insensitivity; but there are times when I do need to apply case sensitivity:
class CGUBackend(BaseBackend):
def authenticate(self, request, username=None, password=None):
#Make sure the username and password are both provided
if username==None or password==None:
return None
try:
userValidObj = vwSTAFF.objects.get(EMPLOYEE_NUMBER=username, PASSWORD=password)
except Exception as ex:
return None
I really do need to enforce case sensitivity on the password.
The code above should be case sensitive shouldn’t it? And I then need to talk to the people who’ve developed the MSSQL package to find out how to apply that sensitivity when needed.