def individual_response_text_message_confirmation(schema, questionnaire_store):
    language_code = get_session_store().session_data.language_code
    individual_response_handler = IndividualResponseHandler(
        schema=schema,
        questionnaire_store=questionnaire_store,
        language=language_code,
        request_args=request.args,
        form_data=request.form,
        list_item_id=None,
    )

    if request.method == "POST":
        return redirect(url_for("questionnaire.get_questionnaire"))

    try:
        mobile_number = url_safe_serializer().loads(request.args["mobile_number"])
    except BadSignature:
        raise BadRequest

    return render_template(
        template="individual_response/confirmation-text-message",
        mobile_number=mobile_number,
        page_title=individual_response_handler.page_title(
            lazy_gettext("An individual access code has been sent by text")
        ),
    )
def request_individual_response(schema, questionnaire_store):
    language_code = get_session_store().session_data.language_code
    list_item_id = request.args.get("list_item_id")

    individual_response_handler = IndividualResponseHandler(
        schema=schema,
        questionnaire_store=questionnaire_store,
        language=language_code,
        request_args=request.args,
        form_data=request.form,
        list_item_id=list_item_id,
    )

    return individual_response_handler.handle_get()
コード例 #3
0
def request_individual_response(schema, questionnaire_store):
    language_code = get_session_store().session_data.language_code
    list_item_id = request.args.get("list_item_id")

    individual_response_handler = IndividualResponseHandler(
        block_definition=None,
        schema=schema,
        questionnaire_store=questionnaire_store,
        language=language_code,
        request_args=request.args,
        form_data=request.form,
        list_item_id=list_item_id,
    )

    if request.method == "POST":
        return individual_response_handler.handle_post()

    return individual_response_handler.handle_get()
def individual_response_post_address_confirmation(schema, questionnaire_store):
    language_code = get_session_store().session_data.language_code
    individual_response_handler = IndividualResponseHandler(
        schema=schema,
        questionnaire_store=questionnaire_store,
        language=language_code,
        request_args=request.args,
        form_data=request.form,
        list_item_id=None,
    )

    if request.method == "POST":
        return redirect(url_for("questionnaire.get_questionnaire"))

    return render_template(
        template="individual_response/confirmation-post",
        display_address=questionnaire_store.metadata.get("display_address"),
        page_title=individual_response_handler.page_title(
            lazy_gettext("An individual access code has been sent by post")
        ),
    )