Beispiel #1
0
 def post(self, request, *args, **kwargs):
     # 前台账号用usr,密码用pwd
     user_ser = serializers.UserSerializer(data=request.data)
     try:
         user_ser.is_valid(raise_exception=True)
     except Exception as e:
         return APIResponse(data_status=1, data_msg='用户名或密码错误')
     return APIResponse(token=user_ser.token,
                        results=serializers.UserSerializer(
                            user_ser.user).data)
Beispiel #2
0
 def delete(self, request, *args, **kwargs):
     response = self.destroy(request, *args, **kwargs)
     return APIResponse(results=response.data)
Beispiel #3
0
 def post(self, request, *args, **kwargs):
     response = self.create(request, *args, **kwargs)
     return APIResponse(results=response.data)
Beispiel #4
0
 def get(self, request, *args, **kwargs):
     response = self.retrieve(request, *args, **kwargs)
     return APIResponse(results=response.data)
Beispiel #5
0
 def put(self, request, *args, **kwargs):
     response = self.partial_update(request, *args, **kwargs)
     return APIResponse(results=response.data)