1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > django @csrf_exempt

django @csrf_exempt

时间:2018-10-30 23:23:34

相关推荐

django @csrf_exempt

在views.py中

from django.views.generic.base import Viewclass ueditor(View):@csrf_exemptdef post(self, request):print(request.POST.get('abc', ""))return render(request, "ueditor.html")

这样写是csrf_exempt是不会生效的

只有继承了django rest framework的apiview有才用:

from rest_framework.views import APIViewclass ueditor(APIView):@csrf_exemptdef post(self, request):print(request.POST.get('abc', ""))return render(request, "ueditor.html")

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。