Working on delete button

This commit is contained in:
FrederikBaerentsen 2024-04-18 11:43:23 +02:00
parent 59064a6088
commit 4a3f7dc1e9
2 changed files with 20 additions and 5 deletions

15
app.py
View File

@ -13,6 +13,19 @@ app = Flask(__name__)
@app.route('/favicon.ico')
@app.route('/delete/<tmp>',methods=['POST', 'GET'])
def delete(tmp):
conn = sqlite3.connect('app.db')
cursor = conn.cursor()
if request.method == 'POST':
print("POST")
if request.method == "GET":
print("GET")
print(tmp)
return redirect('/')
@app.route('/create',methods=['GET', 'POST'])
def create():
conn = sqlite3.connect('app.db')
@ -302,7 +315,7 @@ def inventory(tmp,u_id):
cursor.close()
conn.close()
return render_template('table.html', tmp=tmp,title=set_list[0][1],set_list=set_list,inventory_list=inventory_list,missing_list=missing_list,minifig_list=minifig_list,minifig_inventory_list=minifig_inventory_list)
return render_template('table.html', u_id=u_id,tmp=tmp,title=set_list[0][1],set_list=set_list,inventory_list=inventory_list,missing_list=missing_list,minifig_list=minifig_list,minifig_inventory_list=minifig_inventory_list)
if request.method == 'POST':

View File

@ -259,6 +259,9 @@ td img{
<a class="navbar-item hidden-desktop" id="expand-button">
Expand Columns
</a>
<a class="navbar-item" href="{{ '/delete/' + u_id }}" class="navbar-item">
Delete
</a>
</div>
<div id="navMenu" class="navbar-menu">
@ -267,7 +270,6 @@ td img{
</div>
<div class="navbar-end">
</div>
</div>
</nav>