mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Adds instance name filter to federated instance list view
This lets you look for a specific server in your (probably very long) instance list.
This commit is contained in:
parent
e0a67f5e18
commit
13e23a868d
2 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
{% block filter_fields %}
|
{% block filter_fields %}
|
||||||
{% include 'settings/federation/software_filter.html' %}
|
{% include 'settings/federation/software_filter.html' %}
|
||||||
|
{% include 'settings/users/server_filter.html' %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ class Federation(View):
|
||||||
filters = {}
|
filters = {}
|
||||||
if software := request.GET.get("application_type"):
|
if software := request.GET.get("application_type"):
|
||||||
filters["application_type"] = software
|
filters["application_type"] = software
|
||||||
|
if server := request.GET.get("server"):
|
||||||
|
filters["server_name"] = server
|
||||||
|
|
||||||
servers = models.FederatedServer.objects.filter(status=status, **filters)
|
servers = models.FederatedServer.objects.filter(status=status, **filters)
|
||||||
|
|
||||||
|
@ -60,7 +62,9 @@ class Federation(View):
|
||||||
"sort": sort,
|
"sort": sort,
|
||||||
"software_options": models.FederatedServer.objects.values_list(
|
"software_options": models.FederatedServer.objects.values_list(
|
||||||
"application_type", flat=True
|
"application_type", flat=True
|
||||||
).distinct().order_by("application_type"),
|
)
|
||||||
|
.distinct()
|
||||||
|
.order_by("application_type"),
|
||||||
"form": forms.ServerForm(),
|
"form": forms.ServerForm(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "settings/federation/instance_list.html", data)
|
return TemplateResponse(request, "settings/federation/instance_list.html", data)
|
||||||
|
|
Loading…
Reference in a new issue