stages/prompt: fix error when both default and required are set

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-12-02 20:32:09 +01:00
parent 4bd1cd127b
commit 83ac42ac43
1 changed files with 3 additions and 0 deletions

View File

@ -113,6 +113,9 @@ class Prompt(SerializerModel):
kwargs["label"] = "" kwargs["label"] = ""
if default: if default:
kwargs["default"] = default kwargs["default"] = default
# May not set both `required` and `default`
if "default" in kwargs:
kwargs.pop("required", None)
return field_class(**kwargs) return field_class(**kwargs)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):