Reorder new and popular, change number of packages in each

This commit is contained in:
rubenwardy 2018-07-04 01:20:55 +01:00
parent 7813c766ac
commit a6c8b12cdd
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
2 changed files with 10 additions and 6 deletions

@ -25,10 +25,14 @@ Welcome
<main>
{% from "macros/packagegridtile.html" import render_pkggrid %}
<h2>Newly Added</h2>
{{ render_pkggrid(new) }}
<h2>Popular</h2>
{{ render_pkggrid(popular) }}
<a href="{{ url_for('packages_page') }}" class="button">Show More</a>
<h2 style="margin-top:2em;">Newly Added</h2>
{{ render_pkggrid(new) }}
</main>
{% endblock %}

@ -46,10 +46,10 @@ def send_upload(path):
@app.route("/")
@menu.register_menu(app, ".", "Home")
def home_page():
query = Package.query.filter_by(approved=True, soft_deleted=False)
count = query.count()
new = query.order_by(db.desc(Package.created_at)).limit(3).all()
popular = query.order_by(db.desc(Package.score)).limit(15).all()
query = Package.query.filter_by(approved=True, soft_deleted=False)
count = query.count()
new = query.order_by(db.desc(Package.created_at)).limit(15).all()
popular = query.order_by(db.desc(Package.score)).limit(6).all()
return render_template("index.html", new=new, popular=popular, count=count)
from . import users, githublogin, packages, meta, threads, api