Error posting data
Hello I have the following piece of code and it won't post the data when I click the submit button. Does anyone know what i'm doing wrong?
Login
<link href="/owen/less/login.css" rel="stylesheet" type="text/less" />
<script src="/owen/js/less.js" type="text/javascript"></script>
</head>
<body>
<div id="login">
<h1>Login</h1>
<form action="/login/" method="POST">
{% csrf_token %}
<label for="email">Email:</label>
<input type="text" id="email" placeholder="Email" />
<label for="email">Password:</label>
<input type="password" id="password" placeholder="Password" />
<input type="submit" value="Login" />
</form>
开发者_StackOverflow社区</div>
</body>
</html>
Form data uses name
, not id
. You must give the form controls name
attributes to be used in the data that is submitted to the server.
Look at http://docs.djangoproject.com/en/dev/ref/contrib/csrf/. Are you missing the middleware setting or RequestContext?
精彩评论