def question(self, **kwargs): data = { "id": "example", "type": "date" } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "checkbox_tree", "options": [ { "label": "Option 1", "value": "val1", "options": [ {"label": "Option 1.1", "value": "val1.1"}, {"label": "Option 1.2", "value": "val1.2"}, ] }, { "label": "Option 2", "value": "val2", "options": [ {"label": "Option 2.1", "value": "val2.1"}, {"label": "Option 2.2", "value": "val2.2"}, ] }, {"label": "Option 3", "value": "val3"}, {"label": "Option 4", "value": "val4"}, ] } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "pricing", "fields": { "minimum_price": "priceMin", "maximum_price": "priceMax", } } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "checkboxes", "options": [ {"label": "Wrong label", "value": "value"}, {"label": "Option label", "value": "value1"}, {"label": "Other label", "value": "value2"}, ] } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "pricing", "fields": { "price": "price", "minimum_price": "priceMin", "maximum_price": "priceMax", "price_unit": "priceUnit", "price_interval": "priceInterval", "hours_for_price": "priceHours", } } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "radios", "options": [ {"label": "Wrong label", "value": "value", "description": TemplateField("some description" " [markup](links)")}, {"label": "Option label", "value": "value1"}, {"label": "Wrong label", "value": "value2"}, ], "validations": [ {"name": "answer_required", "message": TemplateField("You have to answer the question")} ] } data.update(kwargs) return ContentQuestion(data)
def question_with_followups(self, **kwargs): data = { "id": "q1", "type": "multiquestion", "questions": [ {"id": "q2", "type": "text"}, {"id": "q3", "type": "boolean", "followup": {"q4": [True], "q5": [True]}}, {"id": "q4", "type": "text", "optional": True}, {"id": "q5", "type": "radios", "options": [{"label": "one"}, {"label": "two"}], "followup": {"q6": ["one"], "q7": ["one"]}}, {"id": "q6", "type": "text"}, {"id": "q7", "type": "text", "optional": True} ] } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "multiquestion", "questions": [ { "id": "example2", "type": "text", }, { "id": "example3", "type": "number", } ] } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "dynamic_list", "question": "Dynamic list", "dynamic_field": "context.field", "questions": [ { "id": "example2", "question": TemplateField("{{ item }}-2"), "type": "text", }, { "id": "example3", "question": TemplateField("{{ item }}-3"), "type": "number", } ] } data.update(kwargs) return ContentQuestion(data).filter({'context': {'field': ['First Need', 'Second Need', 'Third Need']}})
def question(self, **kwargs): data = { "id": "example", "type": "checkbox_tree", "options": [ { "label": "Parent 1 Label", "value": "value_1", "options": [ { "label": "Child 1.1 Label", "value": "value_1_1", }, { "label": "Child 1.2 Label", "value": "value_1_2", }, ] }, { "label": "Parent 2 Label", "value": "value_2", "options": [ { "label": "Child 2.1 Label", "value": "value_2_1", }, ] }, { "label": "Parent 3 Label", "value": "value_3", }, ] } data.update(kwargs) return ContentQuestion(data)
def question(self, **kwargs): data = { "id": "example", "type": "dynamic_list", "question": "Dynamic list", "dynamic_field": "context.field", "questions": [ { "id": "yesno", "question": TemplateField("{{ item }}-yesno"), "type": "boolean", "followup": {"evidence": [True]} }, { "id": "evidence", "question": TemplateField("{{ item }}-evidence"), "type": "text", } ] } data.update(kwargs) return ContentQuestion(data)