From 5d67ba3ead94431ed2d494226e9b942f615f3aa6 Mon Sep 17 00:00:00 2001 From: rb-25 Date: Wed, 29 May 2024 15:52:18 +0530 Subject: [PATCH] feat: error message changed --- gibspons/users/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gibspons/users/views.py b/gibspons/users/views.py index 11cc68b..53eaaaf 100644 --- a/gibspons/users/views.py +++ b/gibspons/users/views.py @@ -30,10 +30,11 @@ def post(self, request): serializer=UserSerializer(data=request.data) try: serializer.is_valid() + serializer.save() + return Response(serializer.data) except: return Response({"detail":serializer.errors},status=status.HTTP_400_BAD_REQUEST) - serializer.save() - return Response(serializer.data) + def get(self,request): serializer = UserSerializer(User.objects.all(), many=True) return Response(serializer.data)