From 42092ff3cb1446dab0726f6d3ed98f9b4a8aa7fc Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Mon, 14 Nov 2016 14:54:49 +0100 Subject: [PATCH] Error handling views in testproject should be updated for latest django --- testproject/testproject/views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/testproject/testproject/views.py b/testproject/testproject/views.py index bb4d607b..0e8828b6 100644 --- a/testproject/testproject/views.py +++ b/testproject/testproject/views.py @@ -6,7 +6,7 @@ from django.views.decorators.csrf import requires_csrf_token @requires_csrf_token -def server_error(request, template_name='500.html'): +def server_error(request, template_name='500.html', **param_dict): # You need to create a 500.html template. t = loader.get_template(template_name) return HttpResponseServerError(t.render(RequestContext( @@ -14,11 +14,16 @@ def server_error(request, template_name='500.html'): { 'MEDIA_URL': settings.MEDIA_URL, 'STATIC_URL': settings.STATIC_URL, + 'request': request, }, ))) -def page_not_found(request, template_name='404.html'): - response = server_error(request, template_name=template_name) +def page_not_found(request, template_name='404.html', exception=None): + response = server_error( + request, + template_name=template_name, + exception=exception + ) response.status_code = 404 return response -- 2.45.2