From a9d07856e4aea7b1d0fd357fb02e0155e079bf9a Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Thu, 21 Apr 2022 00:36:00 +0200 Subject: [PATCH] no more errors for invalid tokens --- shiftregister/app/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shiftregister/app/middleware.py b/shiftregister/app/middleware.py index 35f0821..9ca0701 100644 --- a/shiftregister/app/middleware.py +++ b/shiftregister/app/middleware.py @@ -10,7 +10,7 @@ def check_helper(get_response): # Code to be executed for each request before # the view (and later middleware) are called. if request.session.get("token"): - tk = LoginToken.objects.get(pk=request.session.get("token")) + tk = LoginToken.objects.filter(pk=request.session.get("token")).first() if not tk: del request.session["token"] else: