Revert "try with setting_changed signal"

This reverts commit 32b40a3bbb.
This commit is contained in:
Marc 'risson' Schmitt 2024-01-09 16:39:32 +01:00
parent 250e212703
commit 5b39f8e68b
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
1 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,4 @@
"""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
@ -7,7 +6,7 @@ from django_tenants.utils import get_public_schema_name
from authentik.blueprints.apps import ManagedAppConfig
def ensure_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
def reconcile_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs):
"""Make sure default tenant exists"""
from django_tenants.utils import schema_context
@ -30,6 +29,5 @@ class AuthentikTenantsConfig(ManagedAppConfig):
def reconcile_default_tenant(self):
"""Make sure default tenant exists, especially after a migration"""
ensure_default_tenant()
post_migrate.connect(ensure_default_tenant)
setting_changed.connect(ensure_default_tenant)
reconcile_default_tenant()
post_migrate.connect(reconcile_default_tenant)