def delete_cards(): if request.method == 'POST': db.pop(int(request.form['delete_index'])) save_db() return redirect(url_for('delete_cards')) if request.method == 'GET': return render_template('delete_cards.html', cards=db)
def delete_card(index): try: if request.method == 'POST': db.pop(index) save_db() return redirect(url_for('welcome')) if request.method == 'GET': return render_template('delete_card.html', card=db[index]) except IndexError: abort(404)
def remove_blog(index): try: if request.method == "POST": db.pop(index) save_db() return redirect(url_for('welcome')) else: return render_template("remove_blog.html", blog=db[index]) except IndexError: abort(404)
def remove_card(index): try: if (request.method == "POST"): db.pop(index) save_db() return redirect(url_for("welcome")) else: return render_template("remove_card.html", card=db[index]) except IndexError: abort(404)
def remove_card(index): try: if request.method == "POST": db.pop(index) save_db() return redirect(url_for('index')) else: return render_template('removecard.html', card=db[index]) except IndexError: abort(404)
def remove_card(index): try: if request.method == 'POST': # Delete the entry from the db db.pop(index) save_db() return redirect(url_for('welcome')) except IndexError: abort(404) else: return render_template('remove_card.html', card=db[index])
def del_card(index): try: card = db[index] if request.method == "POST": # form submitted db.pop(index) save_db return redirect(url_for('welcome')) else: return render_template("del_card.html", card=card) except IndexError: abort(404)
def home(): if request.method == "POST": if request.form['nom'] and request.form['prenom'] and request.form[ 'equipe'] != "Choisir l'équipe parmie la liste": nom = request.form['nom'] prenom = request.form['prenom'] equipe = request.form['equipe'] response = request.get_data() personne_select = {"Nom": nom, "Prenom": prenom, "Equipe": equipe} if request.form['type'] == 'update': index = int(request.form['index']) if db[index]['Nom'] == request.form['nom'] and db[index][ 'Prenom'] == request.form['prenom'] and db[index][ 'Equipe'] == request.form['equipe']: print("error") return jsonify( {'error': 'Veuillez modifier au moins un champ'}) else: db[index]['Nom'] = request.form['nom'] db[index]['Prenom'] = request.form['prenom'] db[index]['Equipe'] = request.form['equipe'] save_db() nomPrenom = personne_select['Nom'] + " " + personne_select[ 'Prenom'] return_value = {'nomPrenom': nomPrenom} return return_value elif request.form['type'] == 'suppression': # index = get_index(request.form['nom'], request.form['prenom']) index = int(request.form['index']) db.pop(int(index)) save_db() nomPrenom = personne_select['Nom'] + " " + personne_select[ 'Prenom'] return_value = {'index': index, 'nomPrenom': nomPrenom} return return_value elif request.form['type'] == 'ajout': db.append(personne_select) save_db() nomPrenom = personne_select['Nom'] + " " + personne_select[ 'Prenom'] return_value = {'nomPrenom': nomPrenom} return return_value else: print("error") return jsonify({'error': 'Veuillez remplir tous les champs'}) else: return render_template("member.html", personnes=db)
def delete_tasks(index): db.pop(find_index(index)) save_json() return redirect(url_for('welcome'))