backends: define a total ordering for user's querysets (#49009)
This commit is contained in:
parent
fda0fe2080
commit
5371f986b6
|
@ -76,7 +76,7 @@ class ModelBackend(ModelBackend):
|
|||
users = get_user_queryset().filter(query)
|
||||
# order by username to make username without realm come before usernames with realms
|
||||
# i.e. "toto" should come before "toto@example.com"
|
||||
users = users.order_by('-is_active', UserModel.USERNAME_FIELD)
|
||||
users = users.order_by('-is_active', UserModel.USERNAME_FIELD, 'id')
|
||||
for user in users:
|
||||
if user.check_password(password):
|
||||
user_login_success(user.get_username())
|
||||
|
|
Loading…
Reference in New Issue