From f98017e70ea39acc86cd1c13e36fca5d8924f4f8 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 16 Jun 2014 14:09:42 +0200 Subject: [PATCH] Fix error views so they return the correct HTTP status --- basics/views.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/basics/views.py b/basics/views.py index 83e2f45..8d82a38 100644 --- a/basics/views.py +++ b/basics/views.py @@ -15,13 +15,17 @@ def disclaimer(request): return render(request, 'basics/disclaimer.html', {}) def notfound(request): - return render(request, 'basics/notfound.html', {}) + body = render_to_string('basics/notfound.html', {}) + return HttpResponse(body, status_code = 404) def serverror(request): - return render(request, 'basics/serverror.html', {}) + body = render_to_string('basics/serverror.html', {}) + return HttpResponse(body, status_code = 500) def forbidden(request): - return render(request, 'basics/forbidden.html', {}) + body = render_to_string('basics/forbidden.html', {}) + return HttpResponse(body, status_code = 403) def badrequest(request): - return render(request, 'basics/badrequest.html', {}) + body = render_to_string('basics/badrequest.html', {}) + return HttpResponse(body, status_code = 400)