Remove packages with no approved releases from JSON

This commit is contained in:
rubenwardy 2018-04-08 19:30:57 +01:00
parent a6ccb75ffd
commit 1ecc3db383
1 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,9 @@ def doPackageList(type):
query = query.filter(Package.title.contains(search))
if shouldReturnJson():
return jsonify([package.getAsDictionary(app.config["BASE_URL"]) for package in query.all()])
pkgs = [package.getAsDictionary(app.config["BASE_URL"]) \
for package in query.all() if package.getDownloadRelease() is not None]
return jsonify(pkgs)
else:
tags = Tag.query.all()
return render_template("packages/list.html", title=title, packages=query.all(), query=search, tags=tags, type=None if type is None else type.toName())