From 7b08d47158888d131c6fb16181a4d23f147ce963 Mon Sep 17 00:00:00 2001 From: nick2432 Date: Thu, 22 Feb 2024 15:27:17 +0530 Subject: [PATCH] fix:import-duplicate-usernames --- kolibri/core/auth/management/commands/bulkimportusers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kolibri/core/auth/management/commands/bulkimportusers.py b/kolibri/core/auth/management/commands/bulkimportusers.py index 4a39845373a..400ef4b85e7 100644 --- a/kolibri/core/auth/management/commands/bulkimportusers.py +++ b/kolibri/core/auth/management/commands/bulkimportusers.py @@ -270,8 +270,13 @@ def add_check(self, header_name, check, message): def get_username(self, row): username = row.get(self.header_translation["USERNAME"]) - if username in self.users.keys(): - return None + lowercase_username = username.lower() + + # Convert existing keys in self.users to lowercase + lowercase_users = {key.lower(): value for key, value in self.users.items()} + + if lowercase_username in lowercase_users: + return None # Duplicate username return username