Commit cbc110a4 authored by Luke Plant's avatar Luke Plant
Browse files

[1.2.X] Fixed #14565 - No csrf_token on 404 pages

Thanks to gvangool for report and patch.

Backport of [14356] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14357 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 4527535a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
from django import http
from django.template import Context, RequestContext, loader
from django.views.decorators.csrf import csrf_protect

@csrf_protect
def page_not_found(request, template_name='404.html'):
    """
    Default 404 handler.
@@ -13,6 +15,7 @@ def page_not_found(request, template_name='404.html'):
    t = loader.get_template(template_name) # You need to create a 404.html template.
    return http.HttpResponseNotFound(t.render(RequestContext(request, {'request_path': request.path})))

@csrf_protect
def server_error(request, template_name='500.html'):
    """
    500 error handler.