From d80297e1a87523adc2b5731695cd91f06b265ae6 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 12 Mar 2022 10:00:38 +0100 Subject: [PATCH] Bugfix sorting user table --- cps/admin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cps/admin.py b/cps/admin.py index 4876d421..18bd87ec 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -298,10 +298,13 @@ def list_users(): limit = int(request.args.get("limit") or 10) search = request.args.get("search") sort = request.args.get("sort", "id") - order = request.args.get("order", "").lower() state = None if sort == "state": state = json.loads(request.args.get("state", "[]")) + else: + if sort not in ub.User.__table__.columns.keys(): + sort = "id" + order = request.args.get("order", "").lower() if sort != "state" and order: order = text(sort + " " + order)