fix reconcile

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2024-01-11 14:32:54 +01:00
parent 04ae26c1ba
commit f7b609d8aa
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
1 changed files with 8 additions and 1 deletions

View File

@ -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