User pages.

This commit is contained in:
Edward Betts 2019-09-29 11:52:12 +01:00
parent 1039e9a2d3
commit 8e1de4a2a3

15
app.py
View file

@ -512,6 +512,21 @@ def list_edits():
painting_count=painting_count,
user_count=user_count)
@app.route("/user/<username>")
def user_page(username):
edit_list = Edit.query.filter_by(username=username).order_by(Edit.timestamp)
painting_count = (database.session
.query(func.count(distinct(Edit.painting_id)))
.filter_by(username=username)
.scalar())
return render_template('user_page.html',
username=username,
edits=Edit.query,
edit_list=edit_list,
painting_count=painting_count)
@app.route("/next/Q<int:item_id>")
def next_page(item_id):
qid = f'Q{item_id}'