tenants: avoid extra queries in get_current_tenant (#8367)
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
committed by
GitHub
parent
be6c29d907
commit
c332f6f0ec
@ -6,4 +6,7 @@ from authentik.tenants.models import Tenant
|
||||
|
||||
def get_current_tenant() -> Tenant:
|
||||
"""Get tenant for current request"""
|
||||
tenant = getattr(connection, "tenant", None)
|
||||
if tenant:
|
||||
return tenant
|
||||
return Tenant.objects.get(schema_name=connection.schema_name)
|
||||
|
||||
Reference in New Issue
Block a user