Snippet List
By enabling this backend:
AUTHENTICATION_BACKENDS = (
'path.to.my.backends.CaseInsensitiveModelBackend',
)
Your users will now be able to log in with their username, no matter whether the letters are upper- or lower-case.
- auth
- case
- case-insensitive
- backend
- insensitive
I wanted lookups on tags to be case insensitive by default, so that things like
Tag.objects.get(name='Tag')
would return any similar tags (ignoring case differences), i.e. `<Tag: tag>`.
This snippet makes lookup on the 'name' field case-insensitive by default, although
case-sensitive lookups can still be achieved with 'name__exact'. Methods like get_or_create
will work as expected and be case-insensitive.
- model
- tags
- tagging
- manager
- case-insensitive
- iexact
- queryset
2 snippets posted so far.