U
U
Untiwe2020-12-30 09:37:03
Django
Untiwe, 2020-12-30 09:37:03

How to make case insensitive in django?

Django has a user management system out of the box and I'm happy with it. Additional fields, I made a separate model and a one-to-one relationship with the "User" model. But the system is case sensitive. Admin and admin for her are two different users.
Question: how to remove case sensitivity for "username" and "email"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-12-30
@Untiwe

Write your authentication backend and in the authenticate method do a case-insensitive search for an account in the database. In order not to write a lot, you can inherit it from the boxed one, then you can get by with literally one line of code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question