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.
This commit is contained in:
parent
c9e9e99728
commit
587bab9c64
1 changed files with 7 additions and 2 deletions
|
@ -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
|
Loading…
Reference in a new issue