html ファイルに ; として定義されたボタンがあります。
<input type="submit" value="Log In" name="login_button" style="width: 109px; "/>
このボタンは sample.com にあります。ユーザーが来てこのボタンをクリックすると、現在の Web ページが login.html で定義された にhttp://127.0.0.1:8000/sample
変更されます。http://127.0.0.1:8000/sample2
このため、私はやった;
def auth(request):
if 'login_button' in request.POST:
// redirect the web page to the sample2.com
return render_to_response('login.html', {} )
)しようとしましredirect("http://127.0.0.1:8000/sample2
たが、うまくいきません。別のページに移動するにはどうすればよいですか。
この関数で定義された他の Web ページ
def message(request):
current_date_T = Template ("<p style=\"text-align: right;\">\
{{Date|truncatewords:\"8\"}}\
</p>")
# --
return HttpResponse(html)
URLファイル
urlpatterns = patterns('',
('^sample2/$', message),
('^sample/$', auth),
)
最初に開いたページはサンプルで、その中にボタンがあります。サンプルのボタンがクリックされると、Sample2 が呼び出されます。