Split hard and soft dependers on meta package page

This commit is contained in:
rubenwardy 2020-08-18 17:13:37 +01:00
parent ab7d5a3feb
commit 193e4e39b1
2 changed files with 17 additions and 5 deletions

@ -41,7 +41,15 @@ def view(name):
.filter(MetaPackage.name==name) \
.join(MetaPackage.dependencies) \
.join(Dependency.depender) \
.filter(Package.approved==True, Package.soft_deleted==False) \
.filter(Dependency.optional==False, Package.approved==True, Package.soft_deleted==False) \
.all()
optional_dependers = db.session.query(Package) \
.select_from(MetaPackage) \
.filter(MetaPackage.name==name) \
.join(MetaPackage.dependencies) \
.join(Dependency.depender) \
.filter(Dependency.optional==True, Package.approved==True, Package.soft_deleted==False) \
.all()
similar_topics = None
@ -51,5 +59,6 @@ def view(name):
.order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \
.all()
return render_template("metapackages/view.html", \
mpackage=mpackage, dependers=dependers, similar_topics=similar_topics)
return render_template("metapackages/view.html", mpackage=mpackage, \
dependers=dependers, optional_dependers=optional_dependers, \
similar_topics=similar_topics)

@ -7,7 +7,7 @@
{% block content %}
<h1>Meta Package "{{ mpackage.name }}"</h1>
<h2>Provided by</h2>
<h2>Provided By</h2>
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(mpackage.packages.filter_by(approved=True, soft_deleted=False).all()) }}
@ -27,6 +27,9 @@
</ul>
{% endif %}
<h2>Required / Used by</h2>
<h2>Required By</h2>
{{ render_pkggrid(dependers) }}
<h2>Optionally Used By</h2>
{{ render_pkggrid(optional_dependers) }}
{% endblock %}