Sort federated servers list
This commit is contained in:
parent
158d2c5231
commit
7373a7e8c4
3 changed files with 34 additions and 3 deletions
|
@ -27,8 +27,14 @@ class Federation(View):
|
|||
page = 1
|
||||
|
||||
servers = models.FederatedServer.objects.all()
|
||||
|
||||
sort = request.GET.get('sort')
|
||||
sort_fields = ['created_date', 'application_type', 'server_name']
|
||||
if sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]:
|
||||
servers = servers.order_by(sort)
|
||||
|
||||
paginated = Paginator(servers, PAGE_LENGTH)
|
||||
data = {"servers": paginated.page(page)}
|
||||
data = {"servers": paginated.page(page), "sort": sort}
|
||||
return TemplateResponse(request, "settings/federation.html", data)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue