try with setting_changed signal
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
dee87da591
commit
32b40a3bbb
|
@ -1,4 +1,5 @@
|
|||
"""authentik tenants app"""
|
||||
from django.core.signals import setting_changed
|
||||
from django.db import DEFAULT_DB_ALIAS
|
||||
from django.db.models.signals import post_migrate
|
||||
from django_tenants.utils import get_public_schema_name
|
||||
|
@ -6,7 +7,7 @@ from django_tenants.utils import get_public_schema_name
|
|||
from authentik.blueprints.apps import ManagedAppConfig
|
||||
|
||||
|
||||
def reconcile_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
|
||||
def ensure_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
|
||||
"""Make sure default tenant exists"""
|
||||
from django_tenants.utils import schema_context
|
||||
|
||||
|
@ -29,5 +30,6 @@ class AuthentikTenantsConfig(ManagedAppConfig):
|
|||
|
||||
def reconcile_default_tenant(self):
|
||||
"""Make sure default tenant exists, especially after a migration"""
|
||||
reconcile_default_tenant()
|
||||
post_migrate.connect(reconcile_default_tenant)
|
||||
ensure_default_tenant()
|
||||
post_migrate.connect(ensure_default_tenant)
|
||||
setting_changed.connect(ensure_default_tenant)
|
||||
|
|
Reference in New Issue