Example #1
0
 def put(self, request, pk):
     reservation = get_object_or_404(Reservation.objects.all(), pk=pk)
     serializer = ReservationSerializer(reservation, data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data, status=status.HTTP_200)
     return Response(status=status.HTTP_400_BAD_REQUEST)
Example #2
0
	def post(self, request, pk):
		request.data['event']=pk
		serializer=ReservationSerializer(data=request.data)
		if serializer.is_valid():
			serializer.save()
			return Response(serializer.data, status=status.HTTP_201_CREATED)
		return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)	
Example #3
0
 def post(self, request, pk):
     request.data['event'] = pk
     serializer = ReservationSerializer(data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data, status=status.HTTP_201_CREATED)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Example #4
0
 def post(self, request):
     serializer = ReservationSerializer(data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(status=status.HTTP_201_CREATED)
     return Response(status=status.HTTP_400_BAD_REQUEST)