diff --git a/app/blueprints/admin/tagseditor.py b/app/blueprints/admin/tagseditor.py index d9cc9135..f6dcc198 100644 --- a/app/blueprints/admin/tagseditor.py +++ b/app/blueprints/admin/tagseditor.py @@ -30,7 +30,14 @@ def tag_list(): if not Permission.EDIT_TAGS.check(current_user): abort(403) - return render_template("admin/tags/list.html", tags=Tag.query.order_by(db.asc(Tag.title)).all()) + query = Tag.query + + if request.args.get("sort") == "views": + query = query.order_by(db.desc(Tag.views)) + else: + query = query.order_by(db.asc(Tag.title)) + + return render_template("admin/tags/list.html", tags=query.all()) class TagForm(FlaskForm): title = StringField("Title", [InputRequired(), Length(3,100)]) diff --git a/app/templates/admin/tags/list.html b/app/templates/admin/tags/list.html index 14baf02e..01a54929 100644 --- a/app/templates/admin/tags/list.html +++ b/app/templates/admin/tags/list.html @@ -9,6 +9,12 @@
Also see Package Tags.