コード例 #1
0
    def post(self, request, *args, **kwargs):
        data = request.data
        serializer = UserModelSerializer(data=data)
        serializer.is_valid(raise_exception=True)
        user_obj = serializer.save()

        return Response({"results": UserModelSerializer(user_obj).data})
コード例 #2
0
 def post(self, request, *args, **kwargs):
     data = request.data
     print(data)
     serializer = UserModelSerializer(data=data)
     serializer.is_valid(raise_exception=True)
     save = serializer.save()
     return Response({
         'result': UserModelSerializer(save).data,
     }, status=status.HTTP_201_CREATED)