I'm a little new to Django, and I'm trying to create a login form for the users of my site. I'm using Django's user app. i've created a simple form with username and password fields as follows:
<form id='login-form' action="login" method="post">
<div class='login-field'><input type='text' name='username' placeholder=' Username'></div>
<div class='password-field'><input type='password' name='password' placeholder=' Password'spellcheck='false'></div> <br />
<input type='submit' value='SUBMIT' spellcheck='false'>
</form>
the problem i get when pressing the submit button is:
CSRF verification failed. Request aborted
I've looked through all the solutions to similar questions on this site and others and still haven't been able to solve the problem, any suggestions?
You need {% csrf_token %}
somewhere inside your <form>
tag in the template.
See the Django docs on Cross-site request forgery for more information.