From 31f7dfa8a3b0149a4971c44be0e9f9cd342de5d3 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Tue, 26 Sep 2023 14:28:06 +0930 Subject: [PATCH] #3512 - old managment command using obsolete code --- classification/management/commands/labs_and_users.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/classification/management/commands/labs_and_users.py b/classification/management/commands/labs_and_users.py index 29a47ab1c..b9dd610ef 100644 --- a/classification/management/commands/labs_and_users.py +++ b/classification/management/commands/labs_and_users.py @@ -7,7 +7,7 @@ from django.core.management.base import BaseCommand from snpdb.models.models import Lab, Organization -from snpdb.models.models_user_settings import UserSettings +from snpdb.models.models_user_settings import UserSettings, UserSettingsOverride module_dir = os.path.dirname(__file__) # get current directory lab_path = os.path.join(module_dir, 'labs.csv') @@ -89,10 +89,10 @@ def ensure_users(): if legacy_lab: user.groups.add(legacy_lab.group) - user_settings = UserSettings.get_for_user(user) - if not user_settings.default_lab: - user_settings.default_lab = lab - user_settings.save() + user_settings_override, _ = UserSettingsOverride.objects.get_or_create(user=user) + if not user_settings_override.default_lab: + user_settings_override.default_lab = lab + user_settings_override.save() user.save()