api: ensure viewsets have default ordering
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
d0c56325ef
commit
782764ac73
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Reference in a new issue