Example #1
0
 def signup(self, request):
     serializer = UserSignUpSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     data = UserModelSerializer(user).data
     return Response(
         response_wrapper(data=data, success=True),
         status=status.HTTP_201_CREATED,
     )
Example #2
0
    def profile(self, request, *args, **kwargs):
        user = self.get_object()

        profile = user.profile
        serializer = ProfileModelSerializer(profile,
                                            data=request.data,
                                            partial=True)
        serializer.is_valid(raise_exception=True)
        serializer.save()

        data = UserModelSerializer(user).data
        return Response(data)
Example #3
0
 def retrieve(self, request, pk) -> Response:
     user = self.get_object()
     serialiser = UserModelSerializer(user)
     return Response(serialiser.data)
Example #4
0
 def update(self, request, *args, **kwargs):
     response = super(UserViewSet, self).update(request, *args, **kwargs)
     data = UserModelSerializer(response.data).data
     return Response(data)
Example #5
0
 def retrieve(self, request, pk) -> Response:
     user = self.get_object()
     serialiser = UserModelSerializer(user)
     return Response(response_wrapper(data=serialiser.data, success=True))