From 8afa820078d2fa912cb272a898b7908f330900ea Mon Sep 17 00:00:00 2001 From: arallaer Date: Thu, 23 May 2024 15:48:28 +0200 Subject: [PATCH] api linter --- api/middleware/middleware.py | 2 -- api/middleware/middleware_lesgever_test.py | 3 +-- api/middleware/middleware_original.py | 3 --- api/middleware/middleware_student_test.py | 4 +--- api/views/groep.py | 6 ++++-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/api/middleware/middleware.py b/api/middleware/middleware.py index c51925a8..9bb4e33c 100644 --- a/api/middleware/middleware.py +++ b/api/middleware/middleware.py @@ -84,8 +84,6 @@ def __call__(self, request): return self.get_response(request) - - class DisableCSRFMiddleware(object): def __init__(self, get_response): diff --git a/api/middleware/middleware_lesgever_test.py b/api/middleware/middleware_lesgever_test.py index fde4f9a7..c61be97b 100644 --- a/api/middleware/middleware_lesgever_test.py +++ b/api/middleware/middleware_lesgever_test.py @@ -24,7 +24,7 @@ def __init__(self, get_response): self.get_response = get_response def __call__(self, request): - + mail = "lesgever@testing.com" try: user = User.objects.get(username=mail) @@ -64,7 +64,6 @@ def __call__(self, request): class DisableCSRFMiddleware(object): - def __init__(self, get_response): self.get_response = get_response diff --git a/api/middleware/middleware_original.py b/api/middleware/middleware_original.py index c51925a8..5c1cd207 100644 --- a/api/middleware/middleware_original.py +++ b/api/middleware/middleware_original.py @@ -84,10 +84,7 @@ def __call__(self, request): return self.get_response(request) - - class DisableCSRFMiddleware(object): - def __init__(self, get_response): self.get_response = get_response diff --git a/api/middleware/middleware_student_test.py b/api/middleware/middleware_student_test.py index d679fe77..b82f9f84 100644 --- a/api/middleware/middleware_student_test.py +++ b/api/middleware/middleware_student_test.py @@ -24,7 +24,7 @@ def __init__(self, get_response): self.get_response = get_response def __call__(self, request): - + mail = "student@testing.com" try: user = User.objects.get(username=mail) @@ -51,7 +51,6 @@ def __call__(self, request): if serializer.is_valid(): serializer.save() - gebruiker_post_data = { "user": request.user.id, "subjects": [], @@ -65,7 +64,6 @@ def __call__(self, request): class DisableCSRFMiddleware(object): - def __init__(self, get_response): self.get_response = get_response diff --git a/api/views/groep.py b/api/views/groep.py index 04dc7d45..552b3fb4 100644 --- a/api/views/groep.py +++ b/api/views/groep.py @@ -79,7 +79,9 @@ def groep_detail(request, id, format=None): return Response(serializer.data) if request.method in ["PUT", "PATCH"]: - if has_permissions(request.user) or validate_new_students(request.user, groep, request.data): + if has_permissions(request.user) or validate_new_students( + request.user, groep, request.data + ): if request.method == "PUT": serializer = GroepSerializer(groep, data=request.data) else: @@ -99,5 +101,5 @@ def groep_detail(request, id, format=None): def validate_new_students(user, current_groep, data): old = set(map(lambda student: student.user.id, current_groep.studenten.all())) - new = set(data.get('studenten')) + new = set(data.get("studenten")) return (old - new).union(new - old) == {user.id}