The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Switch error responses to TemplateResponse calls

master
Gergely Polonkai 8 years ago
parent 325660bea1
commit ece6d66bd1
  1. 13
      basics/views.py

@ -2,6 +2,7 @@ from django.shortcuts import render
from django.contrib.sites.models import get_current_site
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.template.response import TemplateResponse
from django.core.urlresolvers import reverse
from StringIO import StringIO
from xhtml2pdf import pisa
@ -39,17 +40,13 @@ def disclaimer(request):
return render(request, 'basics/disclaimer.html', {})
def notfound(request):
body = render_to_string('basics/notfound.html', {})
return HttpResponse(body, status_code = 404)
return TemplateResponse(request, 'basics/notfound.html', status = 404).render()
def serverror(request):
body = render_to_string('basics/serverror.html', {})
return HttpResponse(body, status_code = 500)
return TemplateResponse(request, 'basics/serverror.html', status = 500).render()
def forbidden(request):
body = render_to_string('basics/forbidden.html', {})
return HttpResponse(body, status_code = 403)
return TemplateResponse(request, 'basics/forbidden.html', status = 403).render()
def badrequest(request):
body = render_to_string('basics/badrequest.html', {})
return HttpResponse(body, status_code = 400)
return TemplateResponse(request, 'basics/badrequest.html', status = 400).render()

Loading…
Cancel
Save