aboutsummaryrefslogtreecommitdiff
path: root/app/views/packages/todo.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-12-23 23:49:49 +0000
committerrubenwardy <rw@rubenwardy.com>2018-12-23 23:54:20 +0000
commit50889ccca57cea9166ab7c64a83d540d6c0a20ce (patch)
tree57d757bc7250517b8f4b5e38251b9dfc8422bf8c /app/views/packages/todo.py
parentb8ca5d24c50f108ea574c89405e2ce2e70ea18af (diff)
downloadcheatdb-50889ccca57cea9166ab7c64a83d540d6c0a20ce.tar.xz
Add topic searching and topic discarding
Diffstat (limited to 'app/views/packages/todo.py')
-rw-r--r--app/views/packages/todo.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/views/packages/todo.py b/app/views/packages/todo.py
index 596e83a..a29a46e 100644
--- a/app/views/packages/todo.py
+++ b/app/views/packages/todo.py
@@ -54,11 +54,16 @@ def todo_page():
@app.route("/todo/topics/")
@login_required
def todo_topics_page():
- total = ForumTopic.query.count()
+ query = ForumTopic.query
- query = ForumTopic.query \
- .filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \
- .order_by(db.asc(ForumTopic.wip), db.asc(ForumTopic.name), db.asc(ForumTopic.title))
+ show_discarded = request.args.get("show_discarded") == "True"
+ if not show_discarded:
+ query = query.filter_by(discarded=False)
+
+ total = query.count()
+
+ query = query.filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \
+ .order_by(db.asc(ForumTopic.wip), db.asc(ForumTopic.name), db.asc(ForumTopic.title))
topic_count = query.count()
@@ -75,5 +80,5 @@ def todo_topics_page():
if query.has_prev else None
return render_template("todo/topics.html", topics=query.items, total=total, \
- topic_count=topic_count, query=search, \
+ topic_count=topic_count, query=search, show_discarded=show_discarded, \
next_url=next_url, prev_url=prev_url, page=page, page_max=query.pages)