From 52297b1896790aac551bcbdd3ba0be12f8bfd67d Mon Sep 17 00:00:00 2001 From: Kaustubh Maske Patil <37668193+nikochiko@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:49:56 +0530 Subject: [PATCH] create default handle for workspaces on creation --- workspaces/widgets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/workspaces/widgets.py b/workspaces/widgets.py index cf7735669..2859d43bc 100644 --- a/workspaces/widgets.py +++ b/workspaces/widgets.py @@ -4,7 +4,7 @@ from app_users.models import AppUser from daras_ai_v2 import icons, settings from daras_ai_v2.fastapi_tricks import get_route_path -from handles.models import COMMON_EMAIL_DOMAINS +from handles.models import COMMON_EMAIL_DOMAINS, Handle from .models import Workspace, WorkspaceInvite, WorkspaceRole @@ -114,6 +114,9 @@ def global_workspace_selector(user: AppUser, session: dict): name = get_default_workspace_name_for_user(user) workspace = Workspace(name=name, created_by=user) workspace.create_with_owner() + workspace.handle = Handle.create_default_for_workspace(workspace) + if workspace.handle: + workspace.save() session[SESSION_SELECTED_WORKSPACE] = workspace.id raise gui.RedirectException(get_route_path(members_route))