From 9f9f26974cd7d27766b9e7e6b4b699044b765798 Mon Sep 17 00:00:00 2001 From: Sylvain Boissel Date: Wed, 18 Feb 2026 15:54:15 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8(backend)=20update=20missing=20doc?= =?UTF-8?q?=20management=20in=20onboarding=20sandbox=20feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update _duplicate_onboarding_sandbox_document() to return immediately if the doc defined in settings can't be found. --- src/backend/core/models.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/backend/core/models.py b/src/backend/core/models.py index 9f29b6b9..119b29d3 100644 --- a/src/backend/core/models.py +++ b/src/backend/core/models.py @@ -260,24 +260,25 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin): try: template_document = Document.objects.get(id=sandbox_id) - sandbox_document = template_document.add_sibling( - "right", - title=template_document.title, - content=template_document.content, - attachments=template_document.attachments, - duplicated_from=template_document, - creator=self, - ) - - DocumentAccess.objects.create( - user=self, document=sandbox_document, role=RoleChoices.OWNER - ) - except Document.DoesNotExist: logger.warning( "Onboarding sandbox document with id %s does not exist. Skipping.", sandbox_id, ) + return + + sandbox_document = template_document.add_sibling( + "right", + title=template_document.title, + content=template_document.content, + attachments=template_document.attachments, + duplicated_from=template_document, + creator=self, + ) + + DocumentAccess.objects.create( + user=self, document=sandbox_document, role=RoleChoices.OWNER + ) def _convert_valid_invitations(self): """