From 9e3bf945473e1827989f4812b3287013098cb2fa Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 19 Oct 2022 10:29:03 +0200 Subject: [PATCH] flows: optimise flow API loading speed Signed-off-by: Jens Langhammer --- authentik/flows/api/flows.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index 6a76fcb22..8b5749387 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -40,10 +40,9 @@ LOGGER = get_logger() class FlowSerializer(ModelSerializer): """Flow Serializer""" - cache_count = SerializerMethodField() - background = ReadOnlyField(source="background_url") + cache_count = SerializerMethodField() export_url = SerializerMethodField() def get_cache_count(self, flow: Flow) -> int: @@ -89,7 +88,7 @@ class FlowImportResultSerializer(PassiveSerializer): class FlowViewSet(UsedByMixin, ModelViewSet): """Flow Viewset""" - queryset = Flow.objects.all().prefetch_related("stages") + queryset = Flow.objects.all().prefetch_related("stages", "policies") serializer_class = FlowSerializer lookup_field = "slug" ordering = ["slug", "name"]