diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-07-13 21:28:08 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-07-13 21:28:11 +0100 |
commit | 28ee65809e3933ba08826c9ccddcc651f9dd23b1 (patch) | |
tree | 80bead9206975576e90559caafb1d8d9fc5af254 /app/views/threads.py | |
parent | 1b42f3310a8d19145aa1c870794e394851921083 (diff) | |
download | cheatdb-28ee65809e3933ba08826c9ccddcc651f9dd23b1.tar.xz |
Fix 2 filter_by bugs
Fixes #101
Diffstat (limited to 'app/views/threads.py')
-rw-r--r-- | app/views/threads.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/views/threads.py b/app/views/threads.py index a842d58..2aa815e 100644 --- a/app/views/threads.py +++ b/app/views/threads.py @@ -27,8 +27,10 @@ from wtforms.validators import * @app.route("/threads/") def threads_page(): - threads = Thread.query.filter_by(private=False).all() - return render_template("threads/list.html", threads=threads) + query = Thread.query + if not Permission.SEE_THREAD.check(current_user): + query = query.filter_by(private=False) + return render_template("threads/list.html", threads=query.all()) @app.route("/threads/<int:id>/", methods=["GET", "POST"]) def thread_page(id): |