以下の私の特定の問題に関係なく、同じページに投稿されたユーザーに複数回応答する効果的な方法は何ですか。ページの各プログレッシブ投稿で、新しいリクエストをキャプチャして新しい情報を表示できるようにするには?問題を正しく説明していない場合はご容赦ください。
ユーザーの投稿に反応するページを作成しようとしています。しかし、私は:に遭遇しています
要求の形式が正しくありません
ブラウザ(またはプロキシ)が、このサーバーが理解できない要求を送信しました。
私の現在のソリューションでは、次のように推測しています。
@app.route('/survey', methods = ['GET', 'POST'])$
@contributer_permission.require(403)$
def survey():
organization_id = None
survey_header_id = None
survey_section_id = None
organization_selected = None
survey_header_selected = None
survey_section_selected = None
if request.method== 'POST':
if not organization_id:
organization_id = request.form['organization_id']
organization_selected = Organization.query.get(organization_id)
elif not survey_header_id:
survey_header_id = request.form['survey_header_id']
survey_header_selected = SurveyHeader.query.get(survey_header_id)
elif not survey_section_id:
pass
else:
pass
return render_template('survey.html',
organization_class = Organization,
organization_selected = organization_selected,
organization_id = organization_id,
survey_header_id = survey_header_id,
survey_header_selected = survey_header_selected,
survey_section_id = survey_section_id,
survey_section_selected = survey_section_selected)
私がsurvey_header_idを載せた投稿を受け取ったら。それは再ループし、
organization_id becomes none
これが付随するhtml/jsonです
{% extends "base.html" %}
{% block content %}
<div class ="entries"> <!-- should be a DIV in your style! -->
<form action="{{url_for('survey') }}" method="post" class="add-entry"/>
<dl>
{% if not organization_id %}
{% for organization in organization_class.query.all() %}
<dt><input type="radio", name="organization_id",
value="{{ organization.id }}"/>{{ organization.name }}</dt>
{% endfor %}
<dt><input type ="submit", name="submit_organization"/>
{% elif not survey_header_id %}
<h1>{{ organization_selected.name }}</h1>
{% for survey_header in organization_selected.survey_headers.all() %}
<dt><input type="radio", name="survey_header_id"
value="{{ survey_header.id }}"/>{{ survey_header.name }}
{% endfor %}
<dt><input type ="submit", name="submit_survey_header"/>
{% elif not survey_section_id %}
<p>hi</p>
{% else %}
{% endif %}
<dl>
</form>
</div>
{% endblock %}
私は何をすべきですか?