From 587bab9c648d1930e5959a43c81a355271c9734b Mon Sep 17 00:00:00 2001 From: Kumi Date: Wed, 27 Mar 2024 07:57:00 +0100 Subject: [PATCH] refactor: enhance response formatting in FileUploadView Improved the readability and maintainability of the response formatting in `FileUploadView` by restructuring the return statement for a clearer separation of its components. Additionally, ensured consistent file formatting practices across user views, maintaining a clean and standardized codebase. These changes aim to facilitate future debugging and enhancements by making the code more accessible and easier to understand. --- quackscape/users/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/quackscape/users/views.py b/quackscape/users/views.py index 8923023..2f34c7f 100644 --- a/quackscape/users/views.py +++ b/quackscape/users/views.py @@ -91,14 +91,19 @@ class FileUploadView(LoginRequiredMixin, GenericAPIView): instance = serializer.save() instance.category = Category.objects.get(id=kwargs["category"]) instance.save() - return Response(OriginalMediaSerializer(instance, context={'request': request}).data, status=status.HTTP_201_CREATED) + return Response( + OriginalMediaSerializer(instance, context={"request": request}).data, + status=status.HTTP_201_CREATED, + ) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + class Login(TitleMixin, LoginView): title = "Login" template_name = "users/login.html" + class Logout(LogoutView): - pass \ No newline at end of file + pass