updated migrations + setup process update

This commit is contained in:
vabene1111
2021-02-21 15:34:35 +01:00
parent 846c660811
commit 24e43e3e2e
13 changed files with 164 additions and 141 deletions

View File

@ -2,6 +2,8 @@ from django.shortcuts import redirect
from django.urls import reverse
from django_scopes import scope, scopes_disabled
from cookbook.views import views
class ScopeMiddleware:
def __init__(self, get_response):
@ -10,17 +12,17 @@ class ScopeMiddleware:
def __call__(self, request):
if request.user.is_authenticated:
if request.user.groups.count() == 0:
return redirect('view_no_group')
with scopes_disabled():
if request.user.userpreference.space is None and not reverse('view_no_space') in request.path and not reverse('account_logout') in request.path:
return redirect(reverse('view_no_space'))
if request.path.startswith('/admin/'):
with scopes_disabled():
return self.get_response(request)
with scopes_disabled():
if request.user.userpreference.space is None and not reverse('account_logout') in request.path:
return views.no_space(request)
if request.user.groups.count() == 0 and not reverse('account_logout') in request.path:
return views.no_groups(request)
request.space = request.user.userpreference.space
# with scopes_disabled():
with scope(space=request.space):