调用UserModel.objects.filter(email__iexact=email)
结果如下查询
SELECT * FROM "accounts_person" WHERE "accounts_person"."email" = UPPER('my-email@mail.com')
这没有找到任何东西,因为它EMAIL@MAIL.COM
在数据库中没有,只有email@mail.com
. 查询不应该被翻译成
WHERE UPPER("accounts_person"."email") = UPPER('my-email@mail.com')
?
概括:
UserModel.objects.filter(email=email) # works
UserModel.objects.filter(email__exact=email) # works
UserModel.objects.filter(email__iexact=email) # doesn't work