aboutsummaryrefslogtreecommitdiff
path: root/app/blueprints/users/profile.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-07-12 20:59:06 +0100
committerrubenwardy <rw@rubenwardy.com>2020-07-12 21:02:50 +0100
commitab58570a0c1973e1467101222a6ec6804c4fe1a1 (patch)
tree652ff7626bd72746cb9ff931743b102ee33c3d3f /app/blueprints/users/profile.py
parentcd520a0251ee55cf385bd1e9ed02430f3d57aea7 (diff)
downloadcheatdb-ab58570a0c1973e1467101222a6ec6804c4fe1a1.tar.xz
Redesign user list
Diffstat (limited to 'app/blueprints/users/profile.py')
-rw-r--r--app/blueprints/users/profile.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/blueprints/users/profile.py b/app/blueprints/users/profile.py
index 7973368..5b78fb2 100644
--- a/app/blueprints/users/profile.py
+++ b/app/blueprints/users/profile.py
@@ -28,6 +28,7 @@ from app.utils import randomString, loginUser, rank_required, nonEmptyOrNone, ad
from app.tasks.forumtasks import checkForumAccount
from app.tasks.emails import sendVerifyEmail, sendEmailRaw
from app.tasks.phpbbparser import getProfile
+from sqlalchemy import func
# Define the User profile form
class UserProfileForm(FlaskForm):
@@ -43,7 +44,11 @@ class UserProfileForm(FlaskForm):
@bp.route("/users/", methods=["GET"])
def list_all():
- users = User.query.order_by(db.desc(User.rank), db.asc(User.display_name)).all()
+ users = db.session.query(User, func.count(Package.id)) \
+ .select_from(User).outerjoin(Package) \
+ .order_by(db.desc(User.rank), db.asc(User.display_name)) \
+ .group_by(User.id).all()
+
return render_template("users/list.html", users=users)