From 8760d148486702fc0b621e6ff17c2a7a9d301dd2 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 19 May 2025 10:40:08 +0530 Subject: [PATCH] [FIX] HORILLA API: Login required request issue --- horilla/decorators.py | 5 ++++- horilla_api/api_views/attendance/views.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/horilla/decorators.py b/horilla/decorators.py index 30dd1cf40..5a7e80f5b 100755 --- a/horilla/decorators.py +++ b/horilla/decorators.py @@ -243,7 +243,10 @@ def login_required(view_func): request.session["title"] = "Dashboard".upper() login_url = reverse("login") - query_string = urlencode(request.GET) + try: + query_string = urlencode(request.GET) + except: + query_string = None redirect_url = f"{login_url}?next={request.path}" if query_string: redirect_url += f"&{query_string}" diff --git a/horilla_api/api_views/attendance/views.py b/horilla_api/api_views/attendance/views.py index de3460e92..7005243b7 100644 --- a/horilla_api/api_views/attendance/views.py +++ b/horilla_api/api_views/attendance/views.py @@ -157,6 +157,7 @@ class ClockOutAPIView(APIView): except: pass if request.user.employee_get.check_online(): + print("----------------") current_date = date.today() current_time = datetime.now().time() current_datetime = datetime.now() @@ -174,7 +175,7 @@ class ClockOutAPIView(APIView): except Exception as error: logger.error("Got an error in clock_out", error) - return Response({"message": "Clocked-Out"}, status=200) + # return Response({"message": "Clocked-Out"}, status=200) return Response({"message": "Already clocked-out"}, status=400)