Fix package count on home page

This commit is contained in:
rubenwardy 2018-05-24 20:42:26 +01:00
parent 149b43a013
commit 3565058eea
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
2 changed files with 5 additions and 3 deletions

@ -11,7 +11,7 @@ Welcome
<p>
Minetest's official content repository.
Browse {{ packages | length }} packages,
Browse {{ count }} packages,
all available under a free and open source
license.
</p>

@ -43,8 +43,10 @@ def send_upload(path):
@app.route("/")
@menu.register_menu(app, ".", "Home")
def home_page():
packages = Package.query.filter_by(approved=True).order_by(db.desc(Package.created_at)).limit(15).all()
return render_template("index.html", packages=packages)
query = Package.query.filter_by(approved=True)
count = query.count()
packages = query.order_by(db.desc(Package.created_at)).limit(15).all()
return render_template("index.html", packages=packages, count=count)
from . import users, githublogin, packages, sass, tasks, admin, notifications