diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-06-03 19:24:57 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-06-03 19:27:56 +0100 |
| commit | aad4fd2a705009f6c66834aa2834298f1557d989 (patch) | |
| tree | a798e32045d2145d15c9cbd2a19e6eab05a8dc70 /app/views/packages | |
| parent | d2bda0fded03e46d7c69a411ae3cb5b59597d100 (diff) | |
| download | cheatdb-1.5.0.tar.xz | |
Add list of similar packages in details pagev1.5.0
Diffstat (limited to 'app/views/packages')
| -rw-r--r-- | app/views/packages/__init__.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/views/packages/__init__.py b/app/views/packages/__init__.py index 03a007e..e062268 100644 --- a/app/views/packages/__init__.py +++ b/app/views/packages/__init__.py @@ -96,11 +96,22 @@ def package_page(package): .order_by(db.asc(Package.title)) \ .all() + show_similar_topics = current_user == package.author or \ + package.checkPerm(current_user, Permission.APPROVE_NEW) + + similar_topics = None if not show_similar_topics else \ + KrockForumTopic.query \ + .filter_by(name=package.name) \ + .filter(KrockForumTopic.topic_id != package.forums) \ + .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ + .order_by(db.asc(KrockForumTopic.name), db.asc(KrockForumTopic.title)) \ + .all() + releases = getReleases(package) requests = [r for r in package.requests if r.status == 0] return render_template("packages/view.html", \ package=package, releases=releases, requests=requests, \ - alternatives=alternatives) + alternatives=alternatives, similar_topics=similar_topics) @app.route("/packages/<author>/<name>/download/") |
