In my product details page, I have an "Add to cart" button that is expected to bring out the product through the id on the next page.
This is my view function according to tutorial:
def add_to_cart(request): user = request.user product_id = request.Get.get('prod_id') product = Product.objects.get(id=product_id) Cart(user=user, product=product).save() return redirect("/cart")
In the product_details page, i have the form for the button as:
<form action="/add-to-cart" class="d-inline"><input type="hidden" name="prod_id" value={{product.id}}><button type="submit" class="btn btn-primary shadow px-5 py-2"> Add to Cart</button></form>
Apparently, the name stores the value of the product with the specific id. I am trying to callout the product with the id in the function so it could be added to cart but it comes with an attribute error:'WSGIRequest' object has no attribute 'get'.My lecturer must have done something with this line:product_id = request.Get.get('prod_id')It worked for him in the tutorial.
please help.