From 7ff92bc7c18cc0a742d1e5ff6accd16179d2fd53 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 5 Feb 2021 16:57:40 +0000 Subject: [PATCH] Add ability to filter by no tags on package tags page --- app/blueprints/todo/__init__.py | 7 ++++++- app/templates/todo/tags.html | 13 +++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/blueprints/todo/__init__.py b/app/blueprints/todo/__init__.py index 382b01c1..f083a24b 100644 --- a/app/blueprints/todo/__init__.py +++ b/app/blueprints/todo/__init__.py @@ -117,9 +117,14 @@ def tags(): qb.setSortIfNone("score", "desc") query = qb.buildPackageQuery() + only_no_tags = isYes(request.args.get("no_tags")) + if only_no_tags: + query = query.filter(Package.tags==None) + tags = Tag.query.order_by(db.asc(Tag.title)).all() - return render_template("todo/tags.html", current_tab="tags", packages=query.all(), tags=tags) + return render_template("todo/tags.html", current_tab="tags", packages=query.all(), \ + tags=tags, only_no_tags=only_no_tags) @bp.route("/user/tags/") diff --git a/app/templates/todo/tags.html b/app/templates/todo/tags.html index 6f094e2f..73684ab9 100644 --- a/app/templates/todo/tags.html +++ b/app/templates/todo/tags.html @@ -18,13 +18,22 @@
+ {% if only_no_tags %} + + {{ _("Missing tags only") }} + + {% else %} + + {{ _("Missing tags only") }} + + {% endif %} {% if check_global_perm(current_user, "EDIT_TAGS") %} - {{ _("Edit Tags") }} + {{ _("Edit Tags") }} {% endif %}
- +
Package