私が抱えている問題にとても混乱しているので、誰かが私の間違いを指摘してくれることを願っています.
views.py に、フォームを含むテンプレートにバインドするメソッドがあります。コードは次のようになります。
def template_conf(request, temp_id):
template = ScanTemplate.objects.get(id=int(temp_id))
if request.method == 'GET':
logging.debug('in get method of arachni.template_conf')
temp_form = ScanTemplateForm(instance=template))
return render_response(request, 'arachni/web_scan_template_config.html',
{
'template': template,
'form': temp_form,
})
elif request.method == 'POST':
logging.debug('In post method')
form = ScanTemplateForm(request.POST or None, instance=template)
if form.is_valid():
logging.debug('form is valid')
form.save()
return HttpResponseRedirect('/web_template_conf/%s/' %temp_id)
このページの動作は次のとおりです。「送信」ボタンを押すと、プログラムはブランチに入り、POST
ブランチ内のすべてを正常に実行しました。次に、HttpResponseRedirect
現在のページへの唯一のリダイレクト (その URL は現在の URL です。 と等しいはずです.
)。GET
現在のページにリダイレクトしてからそのブランチが実行され、ページが正常に返されました。ただし、この時点でページを更新すると、ブラウザーは確認の警告を返します。
The page that you're looking for used information that you entered.
Returning to that page might cause any action you took to be repeated.
Do you want to continue?
確認すると、投稿データがバックエンドに再度投稿されます。ブラウザがまだ以前の POST データを保持しているようです。なぜこれが起こるのかわかりません、助けてください。ありがとう。