我正在尝试使用Bootstrap3和Django 1.6.2创建一个简单的注册表单。发生的事情是该视图没有收到de POST请求,我没有发现任何关于我的问题。
home.html的
<form class="form-signup" method="post" action="/sign_up/" role="form">
{% csrf_token %}
<h2 class="form-signup-heading">Sign Up Now...</h2>
<input type="username" class="form-control" placeholder="Username" required autofocus>
<input type="email" class="form-control" placeholder="Email address" required>
<input type="password" class="form-control" placeholder="Password" required>
<input type="password" class="form-control" placeholder="Confirm Password" required>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign up</button>
</form>
view.py
def sign_up(request):
if request.method == "POST":
print request.POST.get('username')
else:
print "get"
此视图方法仅用于调试。 有人对此有任何想法吗?谢谢!