|
|
|
|
@ -20,5 +20,11 @@ def show():
|
|
|
|
|
|
|
|
|
|
@app.post("/")
|
|
|
|
|
def create():
|
|
|
|
|
cursor.execute('INSERT INTO items (title, description) VALUES(?,?)', (request.form['title'],request.form['description']))
|
|
|
|
|
cursor.execute('INSERT INTO items (title, description) VALUES(%s,%s)', (request.form['title'],request.form['description']))
|
|
|
|
|
return redirect('/')
|
|
|
|
|
|
|
|
|
|
@app.post("/<id>")
|
|
|
|
|
def delete(id):
|
|
|
|
|
# print(request.args.get('_method'))
|
|
|
|
|
cursor.execute('DELETE FROM items WHERE id=%s LIMIT 1', [int(id)])
|
|
|
|
|
return redirect('/')
|
|
|
|
|
|