stages/prompt: fix fields not being sorted correctly

This commit is contained in:
Jens Langhammer 2021-02-27 21:03:57 +01:00
parent 0fb17eee43
commit 05a5b5b675
1 changed files with 1 additions and 2 deletions

View File

@ -161,7 +161,7 @@ class PromptStageView(ChallengeStageView):
response_class = PromptResponseChallenge
def get_challenge(self, *args, **kwargs) -> Challenge:
fields = list(self.executor.current_stage.fields.all())
fields = list(self.executor.current_stage.fields.all().order_by("order"))
challenge = PromptChallenge(
data={
"type": ChallengeTypes.native,
@ -185,5 +185,4 @@ class PromptStageView(ChallengeStageView):
if PLAN_CONTEXT_PROMPT not in self.executor.plan.context:
self.executor.plan.context[PLAN_CONTEXT_PROMPT] = {}
self.executor.plan.context[PLAN_CONTEXT_PROMPT].update(response.validated_data)
print(self.executor.plan.context[PLAN_CONTEXT_PROMPT])
return self.executor.stage_ok()