flask sqlite. Комманда удаление выдает ошибку: werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: KeyError: 'name'
Прошу помочь! Flask удаление sqlite не получается. Код НTML:
<h1>UDALENIYA PERSONALA</h1>
<form action="/udaleniya" method="post">
<input type="text" name="name" placeholder="введите имя работника">
<input type="submit" name="submit" value="ОТПРАВИТЬ"><br>
</form>
код main.py:
@app.route('/udaleniya', methods=['POST', 'GET'])
def udaleniya ():
name = request.form['name']
with sqlite3.connect('rabotnikinew.db') as connection:
try:
cursor = connection.cursor()
cursor.execute('DELETE from dannie where name=?', name)
msg='record was deleted'
except:
msg='can not be deleted'
finally:
return render_template('praktika2.html')
connection.close