MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / delete

Function delete

Crud_in_flask/main.py:71–78  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

69
70@app.route('/<int:id>/delete/', methods=('POST',))
71def delete(id):
72 products = get_products(id)
73 conn = get_db_connection()
74 conn.execute('DELETE FROM products WHERE id = ?', (id,))
75 conn.commit()
76 conn.close()
77 flash('"{}" was successfully deleted!'.format(products['title']))
78 return redirect(url_for('index'))
79
80
81@app.route('/')

Callers

nothing calls this directly

Calls 3

get_productsFunction · 0.85
get_db_connectionFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected