def remove_card(index): try: if request.method == 'POST': db.remove(db[index]) return redirect(url_for("welcome")) else: card = db[index] return render_template("remove_card.html", card=card) except IndexError: abort(404)
def remove_card(index): if request.method == "POST": try: card = db[index] db.remove(card) save_db() return redirect(url_for("welcome", cards=db)) except IndexError: abort(404) else: return render_template("remove_card.html", card=db[index])
def remove_card(index): try: if request.method == "POST": db.remove(db[index]) save_db() return redirect(url_for('welcome')) else: card = db[index] return render_template("remove_card.html", card=card, index=index) except IndexError: abort(404)
def remove_card(index): try: card = db[index] if request.method == "POST": print("Card removed successfully") db.remove(card) # or del db[index] save_db() return redirect(url_for('welcome')) else: return render_template("remove_card.html", card=card) except IndexError: abort(404)
def delete_card(): if request.method == "POST": card = { "question": request.form["question"], "answer": request.form["answer"] } db.remove(card) save_db() return redirect(url_for("welcome")) else: return render_template("delete_card.html")
def remove_card_view(index): try: card = db[index] if request.method == 'POST': # del db[index] db.remove(card) save_db() return redirect(url_for('index_view')) return render_template('remove_card.html', card=card, index=index, pagetitle="Remove Flash Card") except IndexError: abort(404)