From f7b609d8aabbdcff81ef1f2e3c39211d99c25e4a Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Thu, 11 Jan 2024 14:32:54 +0100 Subject: [PATCH] fix reconcile Signed-off-by: Marc 'risson' Schmitt --- authentik/blueprints/apps.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/authentik/blueprints/apps.py b/authentik/blueprints/apps.py index c90f9211e..beb85718e 100644 --- a/authentik/blueprints/apps.py +++ b/authentik/blueprints/apps.py @@ -59,7 +59,14 @@ class ManagedAppConfig(AppConfig): def reconcile(self) -> None: """reconcile ourselves""" - from django_tenants.utils import get_public_schema_name + from django_tenants.utils import get_public_schema_name, schema_context + + # Special case for the authentik_tenants app, as we need to create the default tenant + # before being able to use it + if self.label == "authentik_tenants": + with schema_context(get_public_schema_name()): + self._reconcile(self.RECONCILE_PREFIX) + return from authentik.tenants.models import Tenant