Prześlij pliki do ''
This commit is contained in:
parent
bf5dab0de2
commit
12326b5fb7
26
app.py
26
app.py
@ -73,31 +73,6 @@ def addItem():
|
|||||||
print(msg)
|
print(msg)
|
||||||
return redirect(url_for('root'))
|
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")
|
@app.route("/displayCategory")
|
||||||
def displayCategory():
|
def displayCategory():
|
||||||
loggedIn, firstName, noOfItems = getLoginDetails()
|
loggedIn, firstName, noOfItems = getLoginDetails()
|
||||||
@ -338,5 +313,6 @@ def parse(data):
|
|||||||
ans.append(curr)
|
ans.append(curr)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
BIN
database.db
BIN
database.db
Binary file not shown.
Loading…
Reference in New Issue
Block a user