コード例 #1
0
 def post(self, request, format=None):
     serializer = AlumnoSerializers(data=request.data)
     if serializer.is_valid():
         serializer.save()
         datas = serializer.data
         return Response(datas["id"])
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
コード例 #2
0
 def put(self, request, id, format=None):
     alumno = self.get_object(id)
     if alumno != 404:
         serializer = AlumnoSerializers(alumno, data=request.data)
         if serializer.is_valid():
             serializer.save()
             datas = serializer.data
             return Response(datas)
         else:
             return Response(alumno, status=status.HTTP_400_BAD_REQUEST)