@staticmethod
    def template_onaccept(form):

        form_vars = form.vars
        if form_vars.id:
            template_id = form_vars.id
        else:
            return

        add_question = S3SurveyTemplateModel.add_question
        if form_vars.competion_qstn != None:
            name = form_vars.competion_qstn
            code = "STD-WHO"
            notes = "Who completed the assessment"
            qtype = "String"
            posn = -10 # negative used to force these question to appear first
            add_question(template_id, name, code, notes, qtype, posn)
        if form_vars.date_qstn != None:
            name = form_vars.date_qstn
            code = "STD-DATE"
            notes = "Date the assessment was completed"
            qtype = "Date"
            posn += 1
            add_question(template_id, name, code, notes, qtype, posn)
        if form_vars.time_qstn != None:
            name = form_vars.time_qstn
            code = "STD-TIME"
            notes = "Time the assessment was completed"
            qtype = "Time"
            posn += 1
            add_question(template_id, name, code, notes, qtype, posn)
        if form_vars.location_detail != None:
            location_list = json2py(form_vars.location_detail)
            if len(location_list) > 0:
                name = "The location P-code"
                code = "STD-P-Code"
                qtype = "String"
                posn += 1
                add_question(template_id, name, code, None, qtype, posn)
            for loc in location_list:
                if loc == "Lat":
                    name = "Latitude"
                elif loc == "Lon":
                    name = "Longitude"
                else:
                    name = loc
                code = "STD-%s" % loc
                if loc == "Lat" or loc == "Lon":
                    qtype = "Numeric"
                    metadata = {"Format": "nnn.nnnnnn"}
                else:
                    qtype = "Location"
                    metadata = {}
                posn += 1
                add_question(template_id, name, code, "", qtype, posn, metadata)

    # -------------------------------------------------------------------------
All of the standard questions will now be generated
dataset/ETHPy150Open sahana/eden/modules/s3db/survey.py/S3SurveyTemplateModel.template_onaccept