From dbff5435933dc7ca50d42f393b9715e131738f0c Mon Sep 17 00:00:00 2001 From: hole-thu Date: Fri, 4 Sep 2020 23:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BF=BD=E7=95=A5=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=8A=98=E5=8F=A0=E7=9A=84=E6=A0=91=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hole.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hole.py b/hole.py index a160260..dbb91fd 100644 --- a/hole.py +++ b/hole.py @@ -73,8 +73,11 @@ def get_list(): p = request.args.get('p') p = int(p) if p and p.isdigit() else -1 - posts = Post.query.filter_by(deleted=False).order_by(db.desc('timestamp')).paginate(p, PER_PAGE) - + + posts = Post.query.filter_by(deleted=False) + if 'no_cw' in request.args: + posts = posts.filter_by(cw=None) + posts = posts.order_by(db.desc('timestamp')).paginate(p, PER_PAGE) data =list(map(map_post, posts.items, [u.name] * len(posts.items)))