Ticket #14565: add_csrf_protect.diff

File add_csrf_protect.diff, 790 bytes (added by Gert Van Gool, 14 years ago)
  • django/views/defaults.py

    diff --git a/django/views/defaults.py b/django/views/defaults.py
    index 68b9ad6..08c49e0 100644
    a b  
    11from django import http
    22from django.template import Context, RequestContext, loader
     3from django.views.decorators.csrf import csrf_protect
    34
     5@csrf_protect
    46def page_not_found(request, template_name='404.html'):
    57    """
    68    Default 404 handler.
    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
    1619def server_error(request, template_name='500.html'):
    1720    """
    1821    500 error handler.
Back to Top