Created
January 3, 2022 17:01
-
-
Save danfunk/c8e1eda877772aa3ebdda254e07a6b49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_form(task): | |
model = {} | |
form = task.task_spec.form | |
if task.data is None: | |
task.data = {} | |
for field in form.fields: | |
prompt = field.label | |
if isinstance(field, EnumFormField): | |
prompt += "? (Options: " + ', '.join([str(option.id) for option in field.options]) + ")" | |
prompt += "? " | |
answer = input(prompt) | |
if field.type == "long": | |
answer = int(answer) | |
task.update_data_var(field.id,answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment