From ff500b44a60116cf923a03addb509fe2a468fa89 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 8 Jul 2022 22:38:37 +0200 Subject: [PATCH] stages/prompt: force required to false when using readonlyfield Signed-off-by: Jens Langhammer --- authentik/stages/prompt/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/authentik/stages/prompt/models.py b/authentik/stages/prompt/models.py index de401a616..60da2bd88 100644 --- a/authentik/stages/prompt/models.py +++ b/authentik/stages/prompt/models.py @@ -148,6 +148,8 @@ class Prompt(SerializerModel): kwargs["allow_blank"] = not self.required if self.type == FieldTypes.TEXT_READ_ONLY: field_class = ReadOnlyField + # required can't be set for ReadOnlyField + kwargs["required"] = False if self.type == FieldTypes.EMAIL: field_class = EmailField kwargs["allow_blank"] = not self.required