From 782764ac73dd856da146b3b5f99ce659712ca6fa Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 5 Oct 2021 11:26:41 +0200 Subject: [PATCH] api: ensure viewsets have default ordering Signed-off-by: Jens Langhammer --- authentik/core/api/users.py | 1 + authentik/flows/api/flows.py | 1 + authentik/policies/api/policies.py | 1 + 3 files changed, 3 insertions(+) diff --git a/authentik/core/api/users.py b/authentik/core/api/users.py index 623e919dd..013d82685 100644 --- a/authentik/core/api/users.py +++ b/authentik/core/api/users.py @@ -212,6 +212,7 @@ class UserViewSet(UsedByMixin, ModelViewSet): """User Viewset""" queryset = User.objects.none() + ordering = ["username"] serializer_class = UserSerializer search_fields = ["username", "name", "is_active", "email"] filterset_class = UsersFilter diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index 602cc4654..332e525d6 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -108,6 +108,7 @@ class FlowViewSet(UsedByMixin, ModelViewSet): queryset = Flow.objects.all() serializer_class = FlowSerializer lookup_field = "slug" + ordering = ["slug", "name"] search_fields = ["name", "slug", "designation", "title"] filterset_fields = ["flow_uuid", "name", "slug", "designation"] diff --git a/authentik/policies/api/policies.py b/authentik/policies/api/policies.py index 3d3753802..094f894b6 100644 --- a/authentik/policies/api/policies.py +++ b/authentik/policies/api/policies.py @@ -87,6 +87,7 @@ class PolicyViewSet( "promptstage": ["isnull"], } search_fields = ["name"] + ordering = ["name"] def get_queryset(self): # pragma: no cover return Policy.objects.select_subclasses().prefetch_related("bindings", "promptstage_set")