I am getting a 403 error. "CSRF verification failed". I went to the documentation indicated on the error page and I have done everything that it suggested. My view is basically just a copy of the example. But I am still getting the error. I am trying to make a simple login form, here is the template:
<div id="auth"> {% if user.is_authenticated %} {{ user.username }}. Thanks for logging in. {% else %} <form action="/accounts/login/" method="post">{% csrf_token %} <label for="username">User name:</label> <input type="text" name="username" value="" id="username"> <label for="password">Password:</label> <input type="password" name="password" value="" id="password"> <input type="submit" value="login" /> <input type="hidden" name="next" value="{{ next|escape }}" /> </form> {% endif %} </div> And here is the view: def login(request): c = {} c.update(csrf(request)) if request.POST: username = request.POST.get('username', '') password = request.POST.get('password', '') user = auth.authenticate(username=username, password=password) if user is not None and user.is_active: #Password is correct, user is marked "active" auth.login(request, user) #Redirect to a new page return render_to_response('feed.html', c) else: #Show an error and redisplay login return render_to_response('feed.html', c) else: return render_to_response('feed.html', c) Other information: The documentation I am referring to: http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ref-contrib-csrf I am using this middleware in my settings: 'django.middleware.csrf.CsrfViewMiddleware', This is included in my views.py: from django.core.context_processors import csrf Anyone see anything wrong? I really appreciate the help. Thank you in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.