Django 1.2.4 CSRF verification failed

后端 未结 1 588
抹茶落季
抹茶落季 2021-02-15 10:34

Django 1.2 is consistently giving me this CSRF verification error when I perform a POST form. I \"think\" I\'ve done all the things asked in the Django 1.2 docs, namely,

相关标签:
1条回答
  • 2021-02-15 10:51

    You're not following #3. The RequestContext must be used with the rendering of the template that shows the form. It's not necessary for the thanks page.

    return render_to_response('dict/create_definition.html', {
        'form' : form,
    }, context_instance=RequestContext(request))
    

    And as a side note, you should use the PRG pattern instead of rendering the thanks page directly.

    0 讨论(0)
提交回复
热议问题