def get_electronics(): if request.method == "POST": if "add_to_cart" in request.form: item_id = request.form["add_to_cart"] cart.add_to_cart(item_id) if "remove_from_cart" in request.form: item_id = request.form["remove_from_cart"] cart.remove_from_cart(item_id) return render_template( "/listing.html", items=Database.get_item_by_category(Category.ELECTRONIC), listing_title="Electronics", cart=cart, )
def get_furniture(): if request.method == "POST": if "add_to_cart" in request.form: item_id = request.form["add_to_cart"] cart.add_to_cart(item_id) if "remove_from_cart" in request.form: item_id = request.form["remove_from_cart"] cart.remove_from_cart(item_id) return render_template( "/listing.html", items=Database.get_item_by_category(Category.FURNITURE), listing_title="Furniture", cart=cart, )
def get_clothes(): if request.method == "POST": if "add_to_cart" in request.form: item_id = request.form["add_to_cart"] cart.add_to_cart(item_id) if "remove_from_cart" in request.form: item_id = request.form["remove_from_cart"] cart.remove_from_cart(item_id) return render_template( "/listing.html", items=Database.get_item_by_category(Category.CLOTHING), listing_title="Clothes", cart=cart, )
def get_sports(): if request.method == "POST": if "add_to_cart" in request.form: item_id = request.form["add_to_cart"] cart.add_to_cart(item_id) if "remove_from_cart" in request.form: item_id = request.form["remove_from_cart"] cart.remove_from_cart(item_id) return render_template( "/listing.html", items=Database.get_item_by_category(Category.SPORTS_GEAR), listing_title="Sports", cart=cart, )