parent
1c69c634cc
commit
b29ef95c89
1 changed files with 4 additions and 0 deletions
|
@ -20,6 +20,10 @@ class OrganizationMiddleware:
|
|||
organization_slug = url.kwargs.get("organization")
|
||||
if organization_slug:
|
||||
pk = organization_slug.rsplit("-", maxsplit=1)[-1]
|
||||
try:
|
||||
pk = int(pk)
|
||||
except ValueError:
|
||||
pk = -1
|
||||
request.organization = get_object_or_404(Organization, pk=pk)
|
||||
with scope(organization=request.organization):
|
||||
return self.get_response(request)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue