Install polymorphic in prod

This commit is contained in:
2025-11-25 12:26:48 +01:00
parent bf9f43eed8
commit b32d0fd032
2 changed files with 4 additions and 7 deletions

View File

@@ -8,11 +8,7 @@ class RedirectNonSuperuserFromAdminMiddleware:
def __call__(self, request: HttpRequest):
# Se l'utente è loggato, non è superuser e prova ad andare in /admin/...
if hasattr(request,"user"):
if (
request.path.startswith("/admin/") and
hasattr(request.user, 'student')
):
if hasattr(request, "user") and hasattr(request.user, 'student'):
if "/admin/" in request.path:
return redirect("/user/") # redirect automatico
return self.get_response(request)