From 3565058eea6f2ec8f47b0afce068ed0c5e801981 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 24 May 2018 20:42:26 +0100 Subject: [PATCH] Fix package count on home page --- app/templates/index.html | 2 +- app/views/__init__.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index fee35db..41a3990 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -11,7 +11,7 @@ Welcome

Minetest's official content repository. - Browse {{ packages | length }} packages, + Browse {{ count }} packages, all available under a free and open source license.

diff --git a/app/views/__init__.py b/app/views/__init__.py index 28fb518..37474de 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -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