标签:style c class blog code java
<form action = "" method = "post">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input type = "submit" value = "Submit">
</form>
return render_to_response(‘contact_form.html‘,
{‘form‘ : form},context_instance = RequestContext(request))
3.修改settings.py,在MIDDLEWARE_CLASSES中加上‘django.middleware.csrf.CsrfViewMiddleware‘。如下所示:
1 MIDDLEWARE_CLASSES = ( 2 ‘django.contrib.sessions.middleware.SessionMiddleware‘, 3 ‘django.middleware.common.CommonMiddleware‘, 4 ‘django.middleware.csrf.CsrfViewMiddleware‘, 5 ‘django.contrib.auth.middleware.AuthenticationMiddleware‘, 6 ‘django.contrib.messages.middleware.MessageMiddleware‘, 7 ‘django.middleware.clickjacking.XFrameOptionsMiddleware‘, 8 )
django出错:CSRF token missing or incorrect.,布布扣,bubuko.com
django出错:CSRF token missing or incorrect.
标签:style c class blog code java
原文地址:http://www.cnblogs.com/li603572310/p/3747267.html