Skip to content

Commit 851f42b

Browse files
committed
Fixed #14565 - No csrf_token on 404 pages
Thanks to gvangool for report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14356 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 298f3d3 commit 851f42b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

django/views/defaults.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from django import http
22
from django.template import Context, RequestContext, loader
3+
from django.views.decorators.csrf import csrf_protect
34

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

18+
@csrf_protect
1619
def server_error(request, template_name='500.html'):
1720
"""
1821
500 error handler.

0 commit comments

Comments
 (0)