Make CSRF middleware work in Django's 404 error pages

Posted by jack on Stack Overflow See other posts from Stack Overflow or by jack
Published on 2010-03-19T00:36:08Z Indexed on 2010/03/19 0:41 UTC
Read the original article Hit count: 579

Filed under:
|
|
|

I put a login box alone with a keyword search box in 404.html in a Django project so in case a 404 error is raised, visitors get more options to jump to other parts.

But the CSRF middleware doesn't work in 404 error page with no csrf token rendered. I tried move 'django.middleware.csrf.CsrfViewMiddleware' to first of MIDDLEWARE_CLASSES in settings.py but did not work either.

Anyone knows a solution?

© Stack Overflow or respective owner

Related posts about django

Related posts about csrf