#views.py
from django.shortcuts import render_to_response, RequestContext
from django.views.decorators.csrf import csrf_protect
@csrf_protect
def index(request):
if request.method == "GET":
return render_to_response("index.html", context_instance=RequestContext(request))
else:
return render_to_response("index.html", context_instance=RequestContext(request))
#index.html
<form>
{% csrf_token %}
</form>