(self, name, label, data_type='string', group=None, choices=None, label_safe=False, **params)
return Question(name, self, groups)
Adds a question to the XForm.

        Assumes that questions are added in a sane order. You can't add a
        question to a group before you add the group.

        :param name: Question name
        :param label: Question label (can also be a dict: {'en': 'label', 'it': 'cartellino'})
            Note - ensure all langs passed in are in app.langs, lest they be removed during render_xform
        :param data_type: The type of the question, or None for hidden values
        :param group: The name of the question's group, or an iterable of names if nesting is deeper than one
        :param choices: A dictionary of {name: label} pairs
        :param label_safe: Does the label contain (safe) XML?
        :param params: Supported question parameters: repeat_count, QUESTION_PARAMS
        :return: A Question instance, or QuestionGroup instance if `data_type` is a group type.
Adds a question to the XForm.
Adds a question to the XForm .
def new_question(self, name, label, data_type='string', group=None, choices=None, label_safe=False, **params):
        """
        Adds a question to the XForm.

        Assumes that questions are added in a sane order. You can't add a
        question to a group before you add the group.

        :param name: Question name
        :param label: Question label (can also be a dict: {'en': 'label', 'it': 'cartellino'})
            Note - ensure all langs passed in are in app.langs, lest they be removed during render_xform
        :param data_type: The type of the question, or None for hidden values
        :param group: The name of the question's group, or an iterable of names if nesting is deeper than one
        :param choices: A dictionary of {name: label} pairs
        :param label_safe: Does the label contain (safe) XML?
        :param params: Supported question parameters: repeat_count, QUESTION_PARAMS
        :return: A Question instance, or QuestionGroup instance if `data_type` is a group type.
        """
        if data_type is not None and data_type not in ODK_TYPES + GROUP_TYPES:
            raise TypeError('Unknown question data type "{}"'.format(data_type))
        if group is not None and not isinstance(group, str) and not hasattr(group, '__iter__'):
            raise TypeError('group parameter needs to be a string or iterable')
        groups = [group] if isinstance(group, str) else group
        self._append_to_data(name, groups)
        self._append_to_model(name, data_type, groups, **params)
        if data_type is not None:
            self._append_to_translation(name, label, groups, choices, label_safe, **params)
            self._append_to_body(name, data_type, groups, choices, **params)
        if data_type in GROUP_TYPES:
            return QuestionGroup(name, self, groups)
        return Question(name, self, groups)
def new_question ( self , name , label , data_type = 'string' , group = None , choices = None , label_safe = False , * * params ) : if data_type is not None and data_type not in ODK_TYPES + GROUP_TYPES : raise TypeError ( 'Unknown question data type "{}"' . format ( data_type ) ) if group is not None and not isinstance ( group , str ) and not hasattr ( group , '__iter__' ) : raise TypeError ( 'group parameter needs to be a string or iterable' ) groups = [ group ] if isinstance ( group , str ) else group self . _append_to_data ( name , groups ) self . _append_to_model ( name , data_type , groups , * * params ) if data_type is not None : self . _append_to_translation ( name , label , groups , choices , label_safe , * * params ) self . _append_to_body ( name , data_type , groups , choices , * * params ) if data_type in GROUP_TYPES : return QuestionGroup ( name , self , groups ) return Question ( name , self , groups )