Exemple #1
0
    def create(self, request):
        new_itinerary_item = Itinerary()
        new_itinerary_item.starttime = request.data["starttime"]
        new_itinerary_item.customer_id = request.auth.user.id
        new_itinerary_item.attraction_id = request.data["ride_id"]

        new_itinerary_item.save()

        serializer = ItinerarySerializer(new_itinerary_item, context={'request': request})

        return Response(serializer.data)
Exemple #2
0
    def create(self, request):
        itinerary = Itinerary()
        itinerary.starttime = request.data['starttime']
        itinerary.attraction_id = request.data['attraction_id']
        itinerary.customer_id = request.data['customer_id']

        itinerary.save()

        serializer = ItinerarySerializer(itinerary,
                                         context={'request': request})

        return Response(serializer.data)
    def create(self, request):

        attraction = Attraction.objects.get(pk=request.data["attraction_id"])
        customer = Customer.objects.get(user=request.auth.user)

        newitinerary = Itinerary()
        newitinerary.starttime = request.data["starttime"]
        newitinerary.attraction_id = request.data["attraction_id"]
        newitinerary.customer_id = request.data["customer_id"]
        newitinerary.save()

        serializer = ItinerarySerializer(newitinerary,
                                         context={'request': request})

        return Response(serializer.data)
    def create(self, request):
        """Handle POST operations

        Returns:
            Response -- JSON serialized Itinerary instance
        """
        new_itinerary_item = Itinerary()
        new_itinerary_item.starttime = request.data["starttime"]
        new_itinerary_item.customer_id = request.auth.user.customer.id
        new_itinerary_item.attraction_id = request.data["attraction_id"]

        new_itinerary_item.save()

        serializer = ItinerarySerializer(new_itinerary_item, context={'request': request})

        return Response(serializer.data)