cursor -> children

master
Matt Huntington 3 years ago
parent 2c932b0191
commit 97a247e1bd

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

@ -23,7 +23,7 @@
<h2>Items</h2>
{%endif%}
<ul>
{%for (id, title, description, created_at, updated_at, parent_id) in cursor%}
{%for (id, title, description, created_at, updated_at, parent_id) in children%}
<li>
<a href="/{{id}}">{{title}}</a>
</li>

Loading…
Cancel
Save