Bugfix sorting user table

This commit is contained in:
Ozzie Isaacs 2022-03-12 10:00:38 +01:00
parent 49692b4a45
commit d80297e1a8

View File

@ -298,10 +298,13 @@ def list_users():
limit = int(request.args.get("limit") or 10) limit = int(request.args.get("limit") or 10)
search = request.args.get("search") search = request.args.get("search")
sort = request.args.get("sort", "id") sort = request.args.get("sort", "id")
order = request.args.get("order", "").lower()
state = None state = None
if sort == "state": if sort == "state":
state = json.loads(request.args.get("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: if sort != "state" and order:
order = text(sort + " " + order) order = text(sort + " " + order)