fix migrations for template schema 3
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
3b98b1e386
commit
89aa6539b2
|
@ -1,9 +1,13 @@
|
|||
"""Tenant utils"""
|
||||
from django.db import connection
|
||||
from django.db.utils import ProgrammingError
|
||||
|
||||
from authentik.tenants.models import Tenant
|
||||
|
||||
|
||||
def get_current_tenant() -> Tenant | None:
|
||||
"""Get tenant for current request"""
|
||||
try:
|
||||
return Tenant.objects.filter(schema_name=connection.schema_name).first()
|
||||
except ProgrammingError: # We're inside a migration and this table doesn't exist yet
|
||||
return None
|
||||
|
|
Reference in New Issue