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)
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)