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()