def post(self, request, format=None): serializer = CarreraSerializers(data=request.data) if serializer.is_valid(): serializer.save() datas = serializer.data return Response(datas) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def put(self, request, id, format=None): denuncia = self.get_object(id) if denuncia != False: serializer = CarreraSerializers(denuncia, data=request.data) if serializer.is_valid(): serializer.save() datas = serializer.data return Response(datas) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) else: return Response(status=status.HTTP_400_BAD_REQUEST)
def get(self, request, id, format=None): carrera = self.get_object(id) if carrera != False: serializer = CarreraSerializers(carrera) return Response(serializer.data) else: return Response(status=status.HTTP_400_BAD_REQUEST)
def get(self, request, format=None): queryset = Carrera.objects.filter(erase=False) serializer = CarreraSerializers(queryset, many=True) return Response(serializer.data)