2 # Copyright (C) 2018 rubenwardy
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 from flask_user import *
20 from flask.ext import menu
22 from app.models import *
27 canApproveNew = Permission.APPROVE_NEW.check(current_user)
28 canApproveRel = Permission.APPROVE_RELEASE.check(current_user)
29 canApproveScn = Permission.APPROVE_SCREENSHOT.check(current_user)
33 packages = Package.query.filter_by(approved=False, soft_deleted=False).all()
37 releases = PackageRelease.query.filter_by(approved=False).all()
41 screenshots = PackageScreenshot.query.filter_by(approved=False).all()
44 topics_to_add = KrockForumTopic.query \
45 .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \
48 return render_template("todo/list.html", title="Reports and Work Queue",
49 packages=packages, releases=releases, screenshots=screenshots,
50 canApproveNew=canApproveNew, canApproveRel=canApproveRel, canApproveScn=canApproveScn,
51 topics_to_add=topics_to_add)
54 @app.route("/todo/topics/")
56 def todo_topics_page():
57 total = KrockForumTopic.query.count()
59 topics = KrockForumTopic.query \
60 .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \
63 return render_template("todo/topics.html", topics=topics, total=total)