1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

fix: the user list, a user's VMs and the SSH keys come in name order

The user list counts API tokens, and a query with a count has no order
of its own: PostgreSQL lists the users in any order. A user's page
listed the VMs and the SSH keys as stored, so did the profile and the
VM page's key choice.
This commit is contained in:
catborise 2026-11-19 14:31:59 +03:00
parent 94181cfc14
commit 72a2e448d4
5 changed files with 26 additions and 5 deletions

View file

@ -172,7 +172,7 @@ def user_list(request):
users = User.objects.annotate(
api_tokens=Count("auth_token_set", filter=live),
can_clone=Exists(clone.filter(Q(user=OuterRef("pk")) | Q(group__user=OuterRef("pk")))),
).prefetch_related("groups")
).order_by("username").prefetch_related("groups")
return render(
request,
"admin/user_list.html",