|
|
|
@ -28,9 +28,9 @@ app.wsgi_app = HTTPMethodOverrideMiddleware(app.wsgi_app)
|
|
|
|
def show_all():
|
|
|
|
def show_all():
|
|
|
|
cursor.execute('SELECT * FROM items WHERE parent_id IS NULL')
|
|
|
|
cursor.execute('SELECT * FROM items WHERE parent_id IS NULL')
|
|
|
|
if request.cookies.get('movingItemId'):
|
|
|
|
if request.cookies.get('movingItemId'):
|
|
|
|
return render_template('show.html', cursor=cursor, moving_item_id=request.cookies.get('movingItemId'))
|
|
|
|
return render_template('show.html', children=cursor, moving_item_id=request.cookies.get('movingItemId'))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return render_template('show.html', cursor=cursor)
|
|
|
|
return render_template('show.html', children=cursor)
|
|
|
|
|
|
|
|
|
|
|
|
@app.post("/")
|
|
|
|
@app.post("/")
|
|
|
|
def create():
|
|
|
|
def create():
|
|
|
|
@ -73,9 +73,9 @@ def show(id):
|
|
|
|
parent=cursor.fetchone()
|
|
|
|
parent=cursor.fetchone()
|
|
|
|
cursor.execute('SELECT * FROM items WHERE parent_id=%s',[id])
|
|
|
|
cursor.execute('SELECT * FROM items WHERE parent_id=%s',[id])
|
|
|
|
if request.cookies.get('movingItemId'):
|
|
|
|
if request.cookies.get('movingItemId'):
|
|
|
|
return render_template('show.html', parent=parent, cursor=cursor, moving_item_id=request.cookies.get('movingItemId'))
|
|
|
|
return render_template('show.html', parent=parent, children=cursor, moving_item_id=request.cookies.get('movingItemId'))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return render_template('show.html', parent=parent, cursor=cursor)
|
|
|
|
return render_template('show.html', parent=parent, children=cursor)
|
|
|
|
|
|
|
|
|
|
|
|
@app.get('/<int:id>/edit')
|
|
|
|
@app.get('/<int:id>/edit')
|
|
|
|
def edit(id):
|
|
|
|
def edit(id):
|
|
|
|
|