Disable django_scopes in admin namespace
This commit is contained in:
parent
34df06939a
commit
da82b459bd
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import resolve
|
from django.urls import resolve
|
||||||
from django_scopes import scope
|
from django_scopes import scope, scopes_disabled
|
||||||
|
|
||||||
from servala.core.models import Organization
|
from servala.core.models import Organization
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@ class OrganizationMiddleware:
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
url = resolve(request.path_info)
|
url = resolve(request.path_info)
|
||||||
|
|
||||||
|
if "admin" in url.namespaces:
|
||||||
|
with scopes_disabled():
|
||||||
|
return self.get_response(request)
|
||||||
|
|
||||||
organization_slug = url.kwargs.get("organization")
|
organization_slug = url.kwargs.get("organization")
|
||||||
if organization_slug:
|
if organization_slug:
|
||||||
pk = organization_slug.rsplit("-", maxsplit=1)[-1]
|
pk = organization_slug.rsplit("-", maxsplit=1)[-1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue