def questionnaire_preview(request, project_id=None): manager = get_database_manager(request) if request.method == 'GET': previous_link = reverse(subjects_wizard, args=[project_id]) project = models.get_project(project_id, manager) form_model = helper.load_questionnaire(manager, project.qid) fields = form_model.fields if form_model.entity_defaults_to_reporter(): fields = helper.hide_entity_question(form_model.fields) project_links = _make_project_links(project, form_model.form_code) questions = [] for field in fields: question = helper.get_preview_for_field(field) questions.append(question) example_sms = "%s +%s <answer> .... +%s <answer>" % ( form_model.form_code, fields[0].code, fields[len(fields) - 1].code) return render_to_response('project/questionnaire_preview.html', { "questions": questions, 'questionnaire_code': form_model.form_code, "previous": previous_link, 'project': project, 'project_links': project_links, 'example_sms': example_sms }, context_instance=RequestContext(request))
def questionnaire_wizard(request, project_id=None): manager = get_database_manager(request) if request.method == 'GET': previous_link = reverse(subjects_wizard, args=[project_id]) project = models.get_project(project_id, manager) form_model = helper.load_questionnaire(manager, project.qid) fields = form_model.fields if form_model.entity_defaults_to_reporter(): fields = helper.hide_entity_question(form_model.fields) existing_questions = json.dumps(fields, default=field_to_json) return render_to_response('project/questionnaire_wizard.html', {"existing_questions": repr(existing_questions), 'questionnaire_code': form_model.form_code, "previous": previous_link, 'project': project}, context_instance=RequestContext(request))
def questionnaire_wizard(request, project_id=None): manager = get_database_manager(request) if request.method == 'GET': previous_link = reverse(subjects_wizard, args=[project_id]) project = models.get_project(project_id, manager) form_model = helper.load_questionnaire(manager, project.qid) fields = form_model.fields if form_model.entity_defaults_to_reporter(): fields = helper.hide_entity_question(form_model.fields) existing_questions = json.dumps(fields, default=field_to_json) return render_to_response( 'project/questionnaire_wizard.html', { "existing_questions": repr(existing_questions), 'questionnaire_code': form_model.form_code, "previous": previous_link, 'project': project }, context_instance=RequestContext(request))
def questionnaire_preview(request, project_id=None): manager = get_database_manager(request) if request.method == 'GET': previous_link = reverse(subjects_wizard, args=[project_id]) project = models.get_project(project_id, manager) form_model = helper.load_questionnaire(manager, project.qid) fields = form_model.fields if form_model.entity_defaults_to_reporter(): fields = helper.hide_entity_question(form_model.fields) project_links = _make_project_links(project, form_model.form_code) questions = [] for field in fields: question = helper.get_preview_for_field(field) questions.append(question) example_sms = "%s +%s <answer> .... +%s <answer>" % (form_model.form_code, fields[0].code, fields[len(fields)-1].code) return render_to_response('project/questionnaire_preview.html', {"questions": questions, 'questionnaire_code': form_model.form_code, "previous": previous_link, 'project': project, 'project_links': project_links, 'example_sms':example_sms}, context_instance=RequestContext(request))