Prześlij pliki do ''

This commit is contained in:
Sławomir Łopata 2023-02-04 04:08:11 +01:00
parent bf5dab0de2
commit 12326b5fb7
2 changed files with 1 additions and 25 deletions

26
app.py
View File

@ -73,31 +73,6 @@ def addItem():
print(msg)
return redirect(url_for('root'))
@app.route("/remove")
def remove():
with sqlite3.connect('database.db') as conn:
cur = conn.cursor()
cur.execute('SELECT productId, name, price, description, image, stock FROM products')
data = cur.fetchall()
conn.close()
return render_template('remove.html', data=data)
@app.route("/removeItem")
def removeItem():
productId = request.args.get('productId')
with sqlite3.connect('database.db') as conn:
try:
cur = conn.cursor()
cur.execute('DELETE FROM products WHERE productID = ?', (productId, ))
conn.commit()
msg = "Deleted successsfully"
except:
conn.rollback()
msg = "Error occured"
conn.close()
print(msg)
return redirect(url_for('root'))
@app.route("/displayCategory")
def displayCategory():
loggedIn, firstName, noOfItems = getLoginDetails()
@ -338,5 +313,6 @@ def parse(data):
ans.append(curr)
return ans
if __name__ == '__main__':
app.run(debug=True)

Binary file not shown.