def create(self, request):
        """Handle POST operations
        Returns:
            Response -- JSON serialized Product instance
        """
        new_product = Product()
        new_product.name = request.data["name"]
        new_product.customer = Customer.objects.get(user=request.auth.user)
        new_product.price = request.data["price"]
        new_product.description = request.data["description"]
        new_product.quantity = request.data["quantity"]
        new_product.created_at = request.data["created_at"]
        new_product.product_type = ProductType.objects.get(
            pk=request.data["product_type"])
        new_product.location = request.data["location"]
        new_product.save()

        serializer = ProductSerializer(new_product,
                                       context={'request': request})

        return Response(serializer.data)
    def create(self, request, format=None):
        newproduct = Product()
        # product type refers to a foreign key
        product_type = ProductType.objects.get(pk=request.data["product_type"])

        # customer refers to the user
        customer = Customer.objects.get(user=request.auth.user)
        # request all other data
        newproduct.title = request.data["title"]
        newproduct.price = request.data["price"]
        newproduct.description = request.data["description"]
        newproduct.quantity = request.data["quantity"]
        newproduct.location = request.data["location"]
        newproduct.image_path = request.data["image_path"]
        newproduct.customer = customer
        newproduct.product_type = product_type
        newproduct.created_at = datetime.now()

        newproduct.save()

        serializer = SellSerializer(newproduct, context={'request': request})

        return Response(serializer.data)