When sending a request, I get 403? Why?

def index(request): if 'q' in request.POST: q = request.POST['q'] return render_to_response('index.html', {'q': q} ) else: return render_to_response('index.html', {'q': 'error'} ) 

Here's a look if that:

 {{ q }} <form action="" method="POST" /> <input type="text" name="q" /> <input type="submit"> </form> 

tell me ...

    4 answers 4

    In the form add {% csrf_token %}

      Well, first see what django says and most likely it tells you:

      csrf verification failed

        Read about CSRF

          If the CSRF does not matter to you, remove the string 'django.middleware.csrf.CsrfViewMiddleware' from the settings (MIDDLEWARE_CLASSES tuple).