Django : CSRF verification failed even after adding {% csrf_token %}

后端 未结 7 1264
轻奢々
轻奢々 2021-01-03 11:20

views.py:

def index(request):
    return render_to_response(\'index.html\', {})

def photos(request, artist):
    if not artist:
        r         


        
7条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 11:45

    You may need to explicitly pass in a RequestContext instance when you use render_to_response in order to get the CSRF values for that template tag.

    http://lincolnloop.com/blog/2008/may/10/getting-requestcontext-your-templates/

提交回复
热议问题